def __init__(self, node, spec): super().__init__(api.ObjectTypes.SECURITY_PROFILE, node) if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) ############### PUBLIC ATTRIBUTES OF SECURITY PROFILE OBJECT ############### if (hasattr(spec, 'id')): self.SecurityProfileId = spec.id else: self.SecurityProfileId = 1 self.GID('SecurityProfile%d'%self.SecurityProfileId) self.UUID = utils.PdsUuid(self.SecurityProfileId, self.ObjType) self.ConnTrackEn = getattr(spec, 'conntrack', False) deffwaction = getattr(spec, 'deffwaction', 'allow') self.DefaultFWAction = utils.GetRpcSecurityRuleAction(deffwaction) self.TCPIdleTimeout = getattr(spec, 'tcpidletimeout', 600) self.UDPIdleTimeout = getattr(spec, 'udpidletimeout', 120) self.ICMPIdleTimeout = getattr(spec, 'icmpidletimeout', 15) self.OtherIdleTimeout = getattr(spec, 'otheridletimeout', 90) self.TCPCnxnSetupTimeout = getattr(spec, 'tcpsyntimeout', 10) self.TCPHalfCloseTimeout = getattr(spec, 'tcphalfclosetimeout', 120) self.TCPCloseTimeout = getattr(spec, 'tcpclosetimeout', 15) self.TCPDropTimeout = getattr(spec, 'tcpdroptimeout', 90) self.UDPDropTimeout = getattr(spec, 'udpdroptimeout', 60) self.ICMPDropTimeout = getattr(spec, 'icmpdroptimeout', 30) self.OtherDropTimeout = getattr(spec, 'otherdroptimeout', 60) ############### PRIVATE ATTRIBUTES OF SECURITY_PROFILE OBJECT ############### self.__spec = spec self.DeriveOperInfo() self.Mutable = utils.IsUpdateSupported() self.Show() return
def __init__(self, node, spec): super().__init__(api.ObjectTypes.DEVICE, node) self.SetSingleton(True) self.GID("Device1") if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) self.Stack = getattr(spec, 'stack', 'ipv4') ################# PUBLIC ATTRIBUTES OF DEVICE OBJECT ##################### self.Mode = getattr(spec, 'mode', 'auto') if self.Mode == 'auto': self.Mode = utils.GetDefaultDeviceMode() self.BridgingEnabled = getattr(spec, 'bridging', False) self.OverlayRoutingEn = getattr(spec, 'overlayrouting', False) self.SymmetricRoutingEn = getattr(spec, 'symmetricrouting', True) #TODO: based on stack, get ip & gw addr # If loopback ip exists in testbed json, use that, # else use from cfgyaml self.IPAddr = utils.GetNodeLoopbackIp(node) if not self.IPAddr: if getattr(spec, 'ipaddress', None) != None: self.IPAddr = ipaddress.IPv4Address(spec.ipaddress) else: self.IPAddr = next(ResmgrClient[node].TepIpAddressAllocator) if getattr(spec, 'gateway', None) != None: self.GatewayAddr = ipaddress.IPv4Address(spec.gateway) else: self.GatewayAddr = next(ResmgrClient[node].TepIpAddressAllocator) if (hasattr(spec, 'macaddress')): self.MACAddr = spec.macaddress else: self.MACAddr = ResmgrClient[node].DeviceMacAllocator.get() if (hasattr(spec, 'system-mac')): systemMAC = getattr(spec, 'system-mac', None) # Use the system MAC from FRU in the UUID derivation utils.PdsUuid.SetSystemMAC(systemMAC.getnum()) self.IP = str(self.IPAddr) # For testspec # TODO: deprecate EncapType in device self.EncapType = base.Encap.GetRpcEncapType(getattr(spec, 'encap', 'none')) self.PolicyAnyDeny = getattr(spec, 'any-deny-policy', False) self.Mutable = utils.IsUpdateSupported() self.IPMappingClassPriority = getattr(spec, 'ip-mapping-class-priority', 0) self.LearnSpec = LearnSpec(getattr(spec, 'learn-mode', None), \ getattr(spec, 'learn-agetimeout', 300), \ getattr(spec, 'learn-dhcp-enable', True), \ getattr(spec, 'learn-arp-enable', True), \ getattr(spec, 'learn-datapkt-enable', True)) self.LearningEnabled = (self.LearnSpec.LearnMode != device_pb2.LEARN_MODE_NONE) ################# PRIVATE ATTRIBUTES OF DEVICE OBJECT ##################### self.__spec = spec self.DeriveOperInfo() self.Show() if hasattr(spec, 'ipsec'): ipsec.encrypt_client.GenerateObjects(node, self, None, spec.ipsec) ipsec.decrypt_client.GenerateObjects(node, self, None, spec.ipsec) if (hasattr(spec, 'tunnel')): tunnel.client.GenerateObjects(node, self, spec.tunnel) return
def __init__(self, node, parent, spec): super().__init__(api.ObjectTypes.NEXTHOPGROUP, node) if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) elif (EzAccessStoreClient[node].IsDeviceOverlayRoutingEnabled()): self.SetOrigin('discovered') ################# PUBLIC ATTRIBUTES OF NEXTHOPGROUP OBJECT ############ if (hasattr(spec, 'id')): self.Id = spec.id else: self.Id = next(ResmgrClient[node].NexthopGroupIdAllocator) self.GID('NexthopGroup%d' % self.Id) self.UUID = utils.PdsUuid(self.Id, self.ObjType) self.Nexthops = {} self.DualEcmp = utils.IsDualEcmp(spec) self.Type = nh_pb2.NEXTHOP_GROUP_TYPE_NONE if spec.type == 'overlay': self.Type = nh_pb2.NEXTHOP_GROUP_TYPE_OVERLAY_ECMP self.NumNexthops = ResmgrClient[ node].OverlayNumNexthopsAllocator.rrnext() elif spec.type == 'underlay': self.Type = nh_pb2.NEXTHOP_GROUP_TYPE_UNDERLAY_ECMP self.NumNexthops = ResmgrClient[ node].UnderlayNumNexthopsAllocator.rrnext() self.Mutable = utils.IsUpdateSupported() self.Status = NexthopGroupStatus() self.DeriveOperInfo() self.Show() return
def __init__(self, node, parent, spec): super().__init__(api.ObjectTypes.NEXTHOP, node) if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) elif (EzAccessStoreClient[node].IsDeviceOverlayRoutingEnabled()): self.SetOrigin('discovered') ################# PUBLIC ATTRIBUTES OF NEXTHOP OBJECT ##################### if (hasattr(spec, 'id')): self.NexthopId = spec.id else: self.NexthopId = next(ResmgrClient[node].NexthopIdAllocator) self.GID('Nexthop%d' % self.NexthopId) self.UUID = utils.PdsUuid(self.NexthopId, self.ObjType) self.VPC = parent nh_type = getattr(spec, 'type', 'ip') self.DualEcmp = utils.IsDualEcmp(spec) if nh_type == 'ip': self.__type = topo.NhType.IP self.PfxSel = parent.PfxSel self.IPAddr = {} self.IPAddr[0] = next( ResmgrClient[node].NexthopIpV4AddressAllocator) self.IPAddr[1] = next( ResmgrClient[node].NexthopIpV6AddressAllocator) self.VlanId = next(ResmgrClient[node].NexthopVlanIdAllocator) if (hasattr(spec, 'macaddress')): self.MACAddr = spec.macaddress else: self.MACAddr = ResmgrClient[node].NexthopMacAllocator.get() elif nh_type == 'underlay': self.__type = topo.NhType.UNDERLAY self.L3Interface = InterfaceClient.GetL3UplinkInterface(node) self.L3InterfaceId = self.L3Interface.InterfaceId if (hasattr(spec, 'macaddress')): self.underlayMACAddr = spec.macaddress else: self.underlayMACAddr = ResmgrClient[ node].NexthopMacAllocator.get() elif nh_type == 'overlay': self.__type = topo.NhType.OVERLAY if self.DualEcmp: self.TunnelId = ResmgrClient[ node].UnderlayECMPTunAllocator.rrnext().Id elif (hasattr(spec, 'tunnelid')): self.TunnelId = spec.tunnelid else: self.TunnelId = ResmgrClient[node].UnderlayTunAllocator.rrnext( ).Id else: self.__type = topo.NhType.NONE self.Mutable = utils.IsUpdateSupported() self.Status = NexthopStatus() self.DeriveOperInfo() self.Show() return
def __init__(self, node, parent, af, routes, routetype, tunobj, vpcpeerid, spec): super().__init__(api.ObjectTypes.ROUTE, node) self.Class = RouteTableObject if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) elif (EzAccessStoreClient[node].IsDeviceOverlayRoutingEnabled()): self.SetOrigin('discovered') ################# PUBLIC ATTRIBUTES OF ROUTE TABLE OBJECT ##################### if af == utils.IP_VERSION_6: self.RouteTblId = next(ResmgrClient[node].V6RouteTableIdAllocator) self.AddrFamily = 'IPV6' self.NEXTHOP = NexthopClient.GetV6Nexthop(node, parent.VPCId) else: self.RouteTblId = next(ResmgrClient[node].V4RouteTableIdAllocator) self.AddrFamily = 'IPV4' self.NEXTHOP = NexthopClient.GetV4Nexthop(node, parent.VPCId) self.GID('RouteTable%d' % self.RouteTblId) if af == utils.IP_VERSION_4: parent.V4RouteTableName = self.GID() self.UUID = utils.PdsUuid(self.RouteTblId, self.ObjType) self.routes = routes self.MeterEn = False for r in routes.values(): if r.MeterEn: self.MeterEn = True break self.TUNNEL = tunobj self.NhGroup = None self.DualEcmp = utils.IsDualEcmp(spec) self.PriorityType = getattr(spec, "priority", None) if self.TUNNEL: self.TunnelId = self.TUNNEL.Id self.TunEncap = tunobj.Encap else: self.TunnelId = 0 self.NexthopId = self.NEXTHOP.NexthopId if self.NEXTHOP else 0 self.VPCId = parent.VPCId self.VPC = parent self.Label = 'NETWORKING' self.RouteType = routetype # used for lpm route cases self.PeerVPCId = vpcpeerid self.AppPort = ResmgrClient[node].TransportDstPort self.Mutable = utils.IsUpdateSupported() ########################################################################## self.DeriveOperInfo(spec) self.Show() return
def __init__(self, node, spec): super().__init__(api.ObjectTypes.BGP, node) self.BatchUnaware = True self.Id = next(ResmgrClient[node].BgpIdAllocator) self.GID("BGP%d" % self.Id) self.UUID = utils.PdsUuid(self.Id, api.ObjectTypes.BGP) self.Mutable = utils.IsUpdateSupported() self.LocalASN = getattr(spec, "localasn", 0) # If loopback ip exists in testbed json, use that, # else use from cfgyaml self.RouterId = utils.GetNodeLoopbackIp(node) if not self.RouterId: self.RouterId = ipaddress.ip_address(getattr(spec, "routerid", 0)) self.RouterId = int(self.RouterId) self.ClusterId = getattr(spec, "clusterid", 0) self.KeepAliveInterval = topo.KEEPALIVE_INTERVAL self.HoldTime = topo.HOLD_TIME self.Show() return
def __init__(self, node, spec, type): super().__init__(api.ObjectTypes.INTERFACE, node) super().SetOrigin(getattr(spec, 'origin', None)) if hasattr(spec, 'iid'): self.InterfaceId = spec.iid else: self.InterfaceId = next(ResmgrClient[node].InterfaceIdAllocator) self.Type = type if hasattr(spec, 'uuid'): self.UUID = spec.uuid else: self.UUID = utils.PdsUuid(self.InterfaceId, self.ObjType) self.IfName = getattr(spec, 'ifname', None) self.AdminState = getattr(spec, 'ifadminstatus', None) self.MacAddr = getattr(spec, 'macaddress', None) self.VPCId = getattr(spec, 'vpcid', None) self.VrfName = None self.TxPolicer = None if hasattr(spec, 'vrfname'): self.VrfName = spec.vrfname elif self.VPCId: self.VrfName = f'Vpc{self.VPCId}' # Following attributes are valid only for netagent mode self.Speed = '' self.MTU = topo.MTU self.PauseSpec = InterfaceSpec_() self.PauseSpec.Type = 'DISABLE' self.PauseSpec.TxPauseEnabled = False self.PauseSpec.RxPauseEnabled = False self.Status = InterfaceStatus() self.Mutable = utils.IsUpdateSupported() if self.IfName: self.GID(f'{self.IfName}') else: self.GID( f'{topo.INTFTYPE2STR.get(type)}Interface{self.InterfaceId:08x}' ) return
def __init__(self, node, dhcpspec): super().__init__(api.ObjectTypes.DHCP_PROXY, node) if (hasattr(dhcpspec, 'id')): self.Id = dhcpspec.id else: self.Id = next(ResmgrClient[node].DhcpIdAllocator) self.GID("Dhcp%d" % self.Id) self.UUID = utils.PdsUuid(self.Id, self.ObjType) self.ntpserver = [ ipaddress.IPv4Address(ntpserver) for ntpserver in dhcpspec.ntpserver ] self.serverip = ipaddress.IPv4Address(dhcpspec.serverip) self.routers = ipaddress.IPv4Address(dhcpspec.routers) self.dnsserver = [ ipaddress.IPv4Address(dnsserver) for dnsserver in dhcpspec.dnsserver ] self.domainname = getattr(dhcpspec, 'domainname', None) self.filename = getattr(dhcpspec, 'filename', None) self.leasetimeout = getattr(dhcpspec, 'leasetimeout', 3600) self.interfacemtu = dhcpspec.interfacemtu self.Mutable = utils.IsUpdateSupported() return
def __init__(self, node, parent, spec, rxmirror, txmirror): super().__init__(api.ObjectTypes.VNIC, node) self.Class = VnicObject parent.AddChild(self) if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) elif (EzAccessStoreClient[node].IsDeviceLearningEnabled()): self.SetOrigin('discovered') ################# PUBLIC ATTRIBUTES OF VNIC OBJECT ##################### if (hasattr(spec, 'id')): self.VnicId = spec.id else: self.VnicId = next(ResmgrClient[node].VnicIdAllocator) self.GID('Vnic%d' % self.VnicId) self.UUID = utils.PdsUuid(self.VnicId, self.ObjType) self.SUBNET = parent self.HostIfIdx = None self.HostIfUuid = None if utils.IsDol(): node_uuid = None else: node_uuid = EzAccessStoreClient[node].GetNodeUuid(node) hostifidx = getattr(spec, 'hostifidx', None) if hostifidx: self.HostIfIdx = utils.LifIfIndex2HostIfIndex(int(hostifidx)) elif len(parent.HostIfIdx) != 0: self.HostIfIdx = parent.HostIfIdx[0] if self.HostIfIdx: self.HostIfUuid = utils.PdsUuid(self.HostIfIdx, node_uuid=node_uuid) vmac = getattr(spec, 'vmac', None) if vmac: if isinstance(vmac, objects.MacAddressStep): self.MACAddr = vmac.get() elif vmac == 'usepfmac': # used in IOTA for workload interface hostif = InterfaceClient.FindHostInterface( node, self.HostIfIdx) if hostif != None: self.MACAddr = hostif.GetInterfaceMac() else: self.MACAddr = ResmgrClient[node].VnicMacAllocator.get() else: self.MACAddr = vmac else: self.MACAddr = Resmgr.VnicMacAllocator.get() self.VnicEncap = base.Encap.ParseFromSpec( spec, 'vnicencap', 'none', next(ResmgrClient[node].VnicVlanIdAllocator)) self.MplsSlot = next(ResmgrClient[node].VnicMplsSlotIdAllocator) if utils.IsDol(): self.Vnid = next(ResmgrClient[node].VxlanIdAllocator) else: self.Vnid = parent.FabricEncap.GetValue() self.SourceGuard = getattr(spec, 'srcguard', False) self.Primary = getattr(spec, 'primary', False) self.HostName = self.Node self.MaxSessions = getattr(spec, 'maxsessions', 0) self.MeterEn = getattr(spec, 'meteren', False) self.FlowLearnEn = getattr(spec, 'flowlearnen', True) self.SwitchVnic = getattr(spec, 'switchvnic', False) # TODO: clean this host if logic self.UseHostIf = getattr(spec, 'usehostif', True) self.RxMirror = rxmirror self.TxMirror = txmirror self.V4MeterId = MeterClient.GetV4MeterId(node, parent.VPC.VPCId) self.V6MeterId = MeterClient.GetV6MeterId(node, parent.VPC.VPCId) self.IngV4SecurityPolicyIds = [] self.IngV6SecurityPolicyIds = [] self.EgV4SecurityPolicyIds = [] self.EgV6SecurityPolicyIds = [] self.Status = VnicStatus() self.Stats = VnicStats() policerid = getattr(spec, 'rxpolicer', 0) self.RxPolicer = PolicerClient.GetPolicerObject(node, policerid) policerid = getattr(spec, 'txpolicer', 0) self.TxPolicer = PolicerClient.GetPolicerObject(node, policerid) ################# PRIVATE ATTRIBUTES OF VNIC OBJECT ##################### vnicPolicySpec = getattr(spec, 'policy', None) if vnicPolicySpec and utils.IsVnicPolicySupported(): self.IngV4SecurityPolicyIds = utils.GetPolicies( self, vnicPolicySpec, node, "V4", "ingress", False) self.IngV6SecurityPolicyIds = utils.GetPolicies( self, vnicPolicySpec, node, "V6", "ingress", False) self.EgV4SecurityPolicyIds = utils.GetPolicies( self, vnicPolicySpec, node, "V4", "egress", False) self.EgV6SecurityPolicyIds = utils.GetPolicies( self, vnicPolicySpec, node, "V6", "egress", False) self.DeriveOperInfo(node) self.Mutable = True if (utils.IsUpdateSupported() and self.IsOriginFixed()) else False self.VnicType = getattr(spec, 'vnictype', None) self.HasPublicIp = getattr(spec, 'public', False) remote_routes = getattr(spec, 'remoteroutes', []) self.RemoteRoutes = [] for remote_route in remote_routes: self.RemoteRoutes.append(remote_route.replace('\\', '/')) service_ips = getattr(spec, 'serviceips', []) self.ServiceIPs = [] for service_ip in service_ips: self.ServiceIPs.append(service_ip.replace('\\', '/')) self.Movable = getattr(spec, 'movable', False) self.DhcpEnabled = getattr(spec, 'dhcpenabled', False) self.Show() ############### CHILDREN OBJECT GENERATION # Generate MAPPING configuration lmapping.client.GenerateObjects(node, self, spec) return
def __init__(self, node, spec, index, maxcount): super().__init__(api.ObjectTypes.VPC, node) if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) ################# PUBLIC ATTRIBUTES OF VPC OBJECT ##################### if (hasattr(spec, 'id')): self.VPCId = spec.id else: self.VPCId = next(ResmgrClient[node].VpcIdAllocator) self.__index = index self.__count = maxcount self.GID('Vpc%d' % self.VPCId) self.UUID = utils.PdsUuid(self.VPCId, self.ObjType) self.IPPrefix = {} self.Nat46_pfx = None self.V4RouteTableId = 0 self.V6RouteTableId = 0 self.V4RouteTableName = "" if spec.type == 'underlay': self.Type = vpc_pb2.VPC_TYPE_UNDERLAY self.IPPrefix[0] = ResmgrClient[node].ProviderIpV6Network self.IPPrefix[1] = ResmgrClient[node].ProviderIpV4Network # Reserve one SVC port # Right now it does not support multiple backends for a frontend self.SvcPort = ResmgrClient[node].TransportSvcPort self.__max_svc_mapping_shared_count = 1 self.__svc_mapping_shared_count = 0 self.SvcMappingIPAddr = {} elif spec.type == 'control': self.Type = vpc_pb2.VPC_TYPE_CONTROL self.IPPrefix[0] = ResmgrClient[node].GetVpcIPv6Prefix(self.VPCId) if hasattr(spec, "v4prefix"): self.IPPrefix[1] = ipaddress.ip_network( spec.v4prefix.replace('\\', '/')) else: self.IPPrefix[1] = ResmgrClient[node].GetVpcIPv4Prefix( self.VPCId) else: self.Type = vpc_pb2.VPC_TYPE_TENANT self.IPPrefix[0] = ResmgrClient[node].GetVpcIPv6Prefix(self.VPCId) if hasattr(spec, "v4prefix"): self.IPPrefix[1] = ipaddress.ip_network( spec.v4prefix.replace('\\', '/')) else: self.IPPrefix[1] = ResmgrClient[node].GetVpcIPv4Prefix( self.VPCId) if (hasattr(spec, 'nat46')) and spec.nat46 is True: self.Nat46_pfx = ResmgrClient[node].Nat46Address self.Stack = spec.stack # As currently vpc can have only type IPV4 or IPV6, we will alternate # the configuration if self.Stack == 'dual': self.PfxSel = index % 2 elif self.Stack == 'ipv4': self.PfxSel = 1 else: self.PfxSel = 0 self.FabricEncap = base.Encap.ParseFromSpec( spec, "fabricencap", 'vxlan', next(ResmgrClient[node].VxlanIdAllocator)) self.VirtualRouterMACAddr = ResmgrClient[ node].VirtualRouterMacAllocator.get() self.ToS = getattr(spec, 'tos', 0) self.Mutable = utils.IsUpdateSupported() self.Status = VpcStatus() self.UpdateImplicit() ################# PRIVATE ATTRIBUTES OF VPC OBJECT ##################### self.__ip_subnet_prefix_pool = {} self.__ip_subnet_prefix_pool[0] = {} self.__ip_subnet_prefix_pool[1] = {} return
def __init__(self, node, parent, spec, poolid): super().__init__(api.ObjectTypes.SUBNET, node) if hasattr(spec, 'origin'): self.SetOrigin(spec.origin) parent.AddChild(self) ################# PUBLIC ATTRIBUTES OF SUBNET OBJECT ##################### if (hasattr(spec, 'id')): self.SubnetId = spec.id else: self.SubnetId = next(ResmgrClient[node].SubnetIdAllocator) self.GID('Subnet%d' % self.SubnetId) self.UUID = utils.PdsUuid(self.SubnetId, self.ObjType) self.VPC = parent self.PfxSel = parent.PfxSel self.IPPrefix = {} if getattr(spec, 'v6prefix', None) != None or \ getattr(spec, 'v6prefixlen', None) != None: self.IPPrefix[0] = parent.AllocIPv6SubnetPrefix(poolid) self.IpV6Valid = True else: self.IpV6Valid = False if getattr(spec, 'v4prefix', None) != None: self.IPPrefix[1] = ipaddress.ip_network( spec.v4prefix.replace('\\', '/')) else: self.IPPrefix[1] = parent.AllocIPv4SubnetPrefix(poolid) self.ToS = getattr(spec, 'tos', 0) self.VirtualRouterIPAddr = {} self.VirtualRouterMacAddr = None self.V4RouteTableId = route.client.GetRouteV4TableId( node, parent.VPCId) self.V6RouteTableId = route.client.GetRouteV6TableId( node, parent.VPCId) self.IngV4SecurityPolicyIds = utils.GetPolicies( self, spec, node, "V4", "ingress") self.IngV6SecurityPolicyIds = utils.GetPolicies( self, spec, node, "V6", "ingress") self.EgV4SecurityPolicyIds = utils.GetPolicies(self, spec, node, "V4", "egress") self.EgV6SecurityPolicyIds = utils.GetPolicies(self, spec, node, "V6", "egress") self.V4RouteTable = route.client.GetRouteV4Table( node, parent.VPCId, self.V4RouteTableId) self.V6RouteTable = route.client.GetRouteV6Table( node, parent.VPCId, self.V6RouteTableId) self.ToS = 0 self.IPAMname = 'Dhcp1' self.FabricEncap = base.Encap.ParseFromSpec( spec, "fabricencap", 'vxlan', next(ResmgrClient[node].VxlanIdAllocator)) # TODO: clean this host if logic self.HostIfIdx = [] if utils.IsDol(): self.HostIf = InterfaceClient.GetHostInterface(node) if self.HostIf: self.HostIfIdx.append( utils.LifId2HostIfIndex(self.HostIf.lif.id)) node_uuid = None else: self.HostIf = None hostifidx = getattr(spec, 'hostifidx', None) if hostifidx: if isinstance(hostifidx, list): for ifidx in hostifidx: self.HostIfIdx.append( utils.LifIfIndex2HostIfIndex(int(ifidx))) else: self.HostIfIdx.append(int(hostifidx)) elif getattr(spec, 'vnic', None): hostifidx = InterfaceClient.GetHostInterface(node) if hostifidx: self.HostIfIdx.append( utils.LifIfIndex2HostIfIndex(hostifidx)) node_uuid = EzAccessStoreClient[node].GetNodeUuid(node) self.HostIfUuid = [] for ifidx in self.HostIfIdx: self.HostIfUuid.append(utils.PdsUuid(ifidx, node_uuid=node_uuid)) # TODO: randomize maybe? if utils.IsNetAgentMode(): self.DHCPPolicyIds = list( map(lambda x: x.Id, DHCPRelayClient.Objects(node))) else: self.DHCPPolicyIds = getattr(spec, 'dhcppolicy', None) self.Status = SubnetStatus() ################# PRIVATE ATTRIBUTES OF SUBNET OBJECT ##################### if self.IpV6Valid: Resmgr.CreateIPv6AddrPoolForSubnet(self.SubnetId, self.IPPrefix[0]) Resmgr.CreateIPv4AddrPoolForSubnet(self.SubnetId, self.IPPrefix[1]) self.__set_vrouter_attributes(spec) self.DeriveOperInfo() self.Mutable = utils.IsUpdateSupported() self.GenerateChildren(node, spec) self.__fill_default_rules_in_policy(node) self.Show() return