1# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
2# See LICENSE.txt for complete terms.
3
4from mixbox import entities
5from mixbox import fields
6
7import cybox.bindings.network_subnet_object as network_subnet_binding
8from cybox.objects.network_route_entry_object import NetworkRouteEntry
9from cybox.common import ObjectProperties, String, StructuredText, Integer
10
11
12class Routes(entities.EntityList):
13    _binding = network_subnet_binding
14    _binding_class = network_subnet_binding.RoutesType
15    _namespace = "http://cybox.mitre.org/objects#NetworkSubnetObject-2"
16
17    route = fields.TypedField("Route", NetworkRouteEntry, multiple=True)
18
19
20class NetworkSubnet(ObjectProperties):
21    _binding = network_subnet_binding
22    _binding_class = network_subnet_binding.NetworkSubnetObjectType
23    _namespace = "http://cybox.mitre.org/objects#NetworkSubnetObject-2"
24    _XSI_NS = "NetworkSubnetObj"
25    _XSI_TYPE = "NetworkSubnetObjectType"
26
27    name = fields.TypedField("Name", String)
28    description = fields.TypedField("Description", StructuredText)
29    number_of_ip_addresses = fields.TypedField("Number_Of_IP_Addresses", Integer)
30    routes = fields.TypedField("Routes", Routes)
31