Search in sources :

Example 46 with Origin

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();
}
Also used : SiteId(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId) MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)

Example 47 with Origin

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();
}
Also used : SiteId(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId) MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)

Example 48 with Origin

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());
}
Also used : VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) VrfTablesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesBuilder) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin)

Example 49 with Origin

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());
}
Also used : MacVrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntry) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) ArrayList(java.util.ArrayList) MacVrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntryKey) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey) MacVrfEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntryBuilder) VrfEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryBuilder)

Example 50 with Origin

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());
}
Also used : VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) MacVrfEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntryBuilder) MacVrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntryKey) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) MacVrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.macvrfentries.MacVrfEntry)

Aggregations

ArrayList (java.util.ArrayList)18 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)18 Test (org.junit.Test)15 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)14 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)13 FibEntries (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries)12 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AsPathBuilder)12 OriginBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginBuilder)12 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)11 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.UpdateBuilder)11 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)9 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)9 Ipv4NextHopCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCaseBuilder)9 Ipv4NextHopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder)9 ExecutionException (java.util.concurrent.ExecutionException)8 RouteOrigin (org.opendaylight.netvirt.fibmanager.api.RouteOrigin)8 LocalPrefBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.LocalPrefBuilder)8 ByteBuf (io.netty.buffer.ByteBuf)7 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)7 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)7