def PopulateSpec(self, grpcmsg): spec = grpcmsg.Request.add() spec.Id = self.GetKey() spec.Af = utils.GetRpcIPAddrFamily(self.AddrFamily) for rule in self.Rules: tagrulespec = spec.Rules.add() tagrulespec.Tag = rule.TagId tagrulespec.Priority = rule.Priority for prefix in rule.Prefixes: tagprefix = tagrulespec.Prefix.add() utils.GetRpcIPPrefix(prefix, tagprefix) return
def PopulateSpec(self, spec, parent): spec.Id = self.UUID.GetUuid() utils.GetRpcIPPrefix(self.ipaddr, spec.Attrs.Prefix) spec.Attrs.NatAction.SrcNatAction = self.SNatAction spec.Attrs.MeterEn = self.MeterEn spec.Attrs.ClassPriority = self.ClassPriority if self.DstNatIp: spec.Attrs.NatAction.DstNatIP.Af = types_pb2.IP_AF_INET spec.Attrs.NatAction.DstNatIP.V4Addr = \ int(ipaddress.ip_address(self.DstNatIp)) if parent.PriorityType: spec.Attrs.Priority = self.Priority self.PopulateNh(spec, self) else: self.PopulateNh(spec, parent)
def PopulateSpec(self, grpcmsg): spec = grpcmsg.Request.add() spec.Id = self.GetKey() spec.AdminStatus = interface_pb2.IF_STATUS_UP spec.L3IfSpec.PortId = self.Port.GetUuid() # HAL automatically fetches the correct MAC on Naples from hardware # device register - overwriting with topo MAC breaks decap upon rx # from network if utils.IsDol(): spec.L3IfSpec.MACAddress = self.MacAddr.getnum() spec.L3IfSpec.VpcId = utils.PdsUuid.GetUUIDfromId( self.VPCId, api.ObjectTypes.VPC) utils.GetRpcIPPrefix(self.IpPrefix, spec.L3IfSpec.Prefix) utils.GetRpcIfIPPrefix(self.IfIpPrefix, spec.L3IfSpec.Prefix) return
def PopulateSpec(self, grpcmsg): spec = grpcmsg.Request.add() spec.Id = self.GetKey() spec.AdminStatus = interface_pb2.IF_STATUS_UP utils.GetRpcIPPrefix(self.IpPrefix, spec.LoopbackIfSpec.Prefix) return
def FillMeterRulePrefixes(self, rulespec, rule): for pfx in rule.Prefixes: pfxobj = rulespec.Prefix.add() utils.GetRpcIPPrefix(pfx, pfxobj) return