def get_lg_local_info(self, path_prefix): att_dict = {} for attribute in self.attributes.values(): # skip some attributes that we care less about if attribute.ID in (exa.Attribute.CODE.AS_PATH, exa.Attribute.CODE.ORIGIN): continue att_dict[repr(exa.Attribute.CODE(attribute.ID))] = str(attribute) res = { "afi-safi": "%s/%s" % (self.afi, self.safi), "attributes": att_dict, "next_hop": self.nexthop } if self.source: res["source"] = { "id": self.source.name, "href": lg.get_absolute_path("BGP_WORKERS", path_prefix, [self.source.name]) } if self.safi in [exa.SAFI.mpls_vpn, exa.SAFI.evpn]: res["route_targets"] = [str(rt) for rt in self.route_targets] return {repr(self.nlri): res}
def get_lg_local_info(self, path_prefix): driver = { "id": self.driver.type, "href": lg.get_absolute_path("DATAPLANE_DRIVERS", path_prefix, [self.driver.type]) } return { "driver": driver, }
def get_lg_local_info(self, path_prefix): if not self.gw_port: return {"gateway_port": None} else: (linuxif, ipvpn) = self.gw_port return {"gateway_port": { "interface": repr(linuxif), "ipvpn": {"href": lg.get_absolute_path( "VPN_INSTANCES", path_prefix, [ipvpn.external_instance_id]), "id": ipvpn.name, "external_instance_id": ipvpn.external_instance_id }, }}