use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Origin in project lispflowmapping by opendaylight.
the class DSBEInputUtil method toMapping.
public static Mapping toMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mappingData) {
MappingRecord record = (mappingData != null) ? mappingData.getRecord() : null;
List<SiteId> siteIds = (siteId != null) ? Arrays.asList(siteId) : null;
return new MappingBuilder().setEidUri(new EidUri(LispAddressStringifier.getURIString(key))).setOrigin(origin).setSiteId(siteIds).setMappingRecord(record).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Origin in project lispflowmapping by opendaylight.
the class DSBEInputUtil method toMapping.
public static Mapping toMapping(MappingOrigin origin, Eid key, @Nullable MappingData mappingData) {
MappingRecord record = (mappingData != null) ? mappingData.getRecord() : new MappingRecordBuilder().setEid(key).build();
SiteId siteId = (record != null) ? record.getSiteId() : null;
List<SiteId> siteIds = (siteId != null) ? Arrays.asList(siteId) : null;
return new MappingBuilder().setEidUri(new EidUri(LispAddressStringifier.getURIString(key))).setOrigin(origin).setSiteId(siteIds).setMappingRecord(record).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Origin in project netvirt by opendaylight.
the class VpnInterfaceManager method importSubnetRouteForNewVpn.
public synchronized void importSubnetRouteForNewVpn(String rd, String prefix, String nextHop, Uint32 label, SubnetRoute route, String parentVpnRd, TypedWriteTransaction<Configuration> writeConfigTxn) {
RouteOrigin origin = RouteOrigin.SELF_IMPORTED;
VrfEntry vrfEntry = FibHelper.getVrfEntryBuilder(prefix, label, nextHop, origin, parentVpnRd).addAugmentation(route).build();
List<VrfEntry> vrfEntryList = Collections.singletonList(vrfEntry);
InstanceIdentifierBuilder<VrfTables> idBuilder = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd));
InstanceIdentifier<VrfTables> vrfTableId = idBuilder.build();
VrfTables vrfTableNew = new VrfTablesBuilder().setRouteDistinguisher(rd).setVrfEntry(vrfEntryList).build();
if (writeConfigTxn != null) {
writeConfigTxn.mergeParentStructureMerge(vrfTableId, vrfTableNew);
} else {
vpnUtil.syncUpdate(LogicalDatastoreType.CONFIGURATION, vrfTableId, vrfTableNew);
}
LOG.info("SUBNETROUTE: importSubnetRouteForNewVpn: Created vrfEntry for rd {} prefix {} nexthop {} label {}" + " and elantag {}", rd, prefix, nextHop, label, route.getElantag());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Origin in project netvirt by opendaylight.
the class FibDSWriter method addFibEntryToDS.
public synchronized void addFibEntryToDS(String rd, String prefix, List<String> nextHopList, VrfEntry.EncapType encapType, Uint32 label, Uint32 l3vni, String gatewayMacAddress, RouteOrigin origin) {
if (rd == null || rd.isEmpty()) {
LOG.error("Prefix {} not associated with vpn", prefix);
return;
}
requireNonNull(nextHopList, "NextHopList can't be null");
for (String nextHop : nextHopList) {
if (nextHop == null || nextHop.isEmpty()) {
LOG.error("nextHop list contains null element");
return;
}
LOG.debug("Created vrfEntry for {} nexthop {} label {}", prefix, nextHop, label);
}
LOG.debug("addFibEntryToDS rd {} prefix {} NH {}", rd, prefix, nextHopList.get(0));
ArrayList<String> temp = new ArrayList<>();
if (fibMap.get(appendrdtoprefix(rd, prefix)) != null) {
temp.addAll(fibMap.get(appendrdtoprefix(rd, prefix)));
}
if (!temp.contains(nextHopList.get(0))) {
temp.addAll(nextHopList);
fibMap.put(appendrdtoprefix(rd, prefix), temp);
}
// Looking for existing prefix in MDSAL database
InstanceIdentifier<VrfEntry> vrfEntryId = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(VrfEntry.class, new VrfEntryKey(prefix)).build();
VrfEntryBuilder vrfEntryBuilder = new VrfEntryBuilder().setDestPrefix(prefix).setOrigin(origin.getValue());
buildVpnEncapSpecificInfo(vrfEntryBuilder, encapType, label, l3vni, gatewayMacAddress, nextHopList);
bgpUtil.update(vrfEntryId, vrfEntryBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Origin in project netvirt by opendaylight.
the class FibDSWriter method addMacEntryToDS.
public void addMacEntryToDS(String rd, String macAddress, String prefix, List<String> nextHopList, VrfEntry.EncapType encapType, Uint32 l2vni, String gatewayMacAddress, RouteOrigin origin) {
if (StringUtils.isEmpty(rd)) {
LOG.error("Mac {} not associated with vpn", macAddress);
return;
}
requireNonNull(nextHopList, "NextHopList can't be null");
for (String nextHop : nextHopList) {
if (StringUtils.isEmpty(nextHop)) {
LOG.error("nextHop list contains null element for macVrf");
return;
}
}
MacVrfEntryBuilder macEntryBuilder = new MacVrfEntryBuilder().setOrigin(origin.getValue());
buildVpnEncapSpecificInfo(macEntryBuilder, encapType, l2vni, gatewayMacAddress, nextHopList);
macEntryBuilder.setMac(macAddress);
macEntryBuilder.setDestPrefix(prefix);
InstanceIdentifier<MacVrfEntry> macEntryId = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(MacVrfEntry.class, new MacVrfEntryKey(macAddress)).build();
bgpUtil.update(macEntryId, macEntryBuilder.build());
}
Aggregations