use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry in project netvirt by opendaylight.
the class VpnUtil method getRts.
public static List<String> getRts(VpnInstanceOpDataEntry vpnInstance, VpnTarget.VrfRTType rtType) {
String name = vpnInstance.getVpnInstanceName();
List<String> rts = new ArrayList<>();
VpnTargets targets = vpnInstance.getVpnTargets();
if (targets == null) {
LOG.info("getRts: vpn targets not available for {}", name);
return rts;
}
List<VpnTarget> vpnTargets = targets.getVpnTarget();
if (vpnTargets == null) {
LOG.info("getRts: vpnTarget values not available for {}", name);
return rts;
}
for (VpnTarget target : vpnTargets) {
// TODO: Check for RT type is Both
if (target.getVrfRTType().equals(rtType) || target.getVrfRTType().equals(VpnTarget.VrfRTType.Both)) {
String rtValue = target.getVrfRTValue();
rts.add(rtValue);
}
}
return rts;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry in project netvirt by opendaylight.
the class VpnUtil method getDpnsOnVpn.
@Nonnull
public static List<BigInteger> getDpnsOnVpn(DataBroker dataBroker, String vpnInstanceName) {
List<BigInteger> result = new ArrayList<>();
String rd = getVpnRd(dataBroker, vpnInstanceName);
if (rd == null) {
LOG.debug("getDpnsOnVpn: Could not find Route-Distinguisher for VpnName={}", vpnInstanceName);
return result;
}
VpnInstanceOpDataEntry vpnInstanceOpData = getVpnInstanceOpData(dataBroker, rd);
if (vpnInstanceOpData == null) {
LOG.debug("getDpnsOnVpn: Could not find OpState for VpnName={}", vpnInstanceName);
return result;
}
List<VpnToDpnList> vpnToDpnList = vpnInstanceOpData.getVpnToDpnList();
if (vpnToDpnList == null) {
LOG.debug("getDpnsOnVpn: Could not find DPN footprint for VpnName={}", vpnInstanceName);
return result;
}
for (VpnToDpnList vpnToDpn : vpnToDpnList) {
result.add(vpnToDpn.getDpnId());
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry in project netvirt by opendaylight.
the class InterVpnLinkLocator method getRts.
private List<String> getRts(VpnInstanceOpDataEntry vpnInstance, VpnTarget.VrfRTType rtType) {
String name = vpnInstance.getVpnInstanceName();
VpnTargets targets = vpnInstance.getVpnTargets();
if (targets == null) {
LOG.trace("vpn targets not available for {}", name);
return new ArrayList<>();
}
List<VpnTarget> vpnTargets = targets.getVpnTarget();
if (vpnTargets == null) {
LOG.trace("vpnTarget values not available for {}", name);
return new ArrayList<>();
}
return vpnTargets.stream().filter(target -> target.getVrfRTType().equals(rtType) || target.getVrfRTType().equals(VpnTarget.VrfRTType.Both)).map(VpnTarget::getVrfRTValue).collect(Collectors.toList());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry in project netvirt by opendaylight.
the class L3VpnTestCatalog method build.
static L3VpnComposite build(String vpnName, String vpnRd, long vpnTag, List<String> irts, List<String> erts) {
Objects.nonNull(irts);
Objects.nonNull(erts);
Ipv4Family vpnIpv4Cfg = new Ipv4FamilyBuilder().setVpnTargets(makeVpnTargets(irts, erts)).build();
VpnInstance vpnInst = new VpnInstanceBuilder().setVpnInstanceName(vpnName).setIpv4Family(vpnIpv4Cfg).build();
VpnInstanceOpDataEntry vpnOpData = new VpnInstanceOpDataEntryBuilder().setVpnId(vpnTag).setVpnInstanceName(vpnName).setVrfId(vpnRd).setVpnTargets(VpnOperDsUtils.makeVpnTargets(irts, erts)).build();
return new L3VpnComposite(vpnInst, vpnOpData);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry in project netvirt by opendaylight.
the class VpnManagerImpl method addExtraRoute.
@Override
public void addExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID, int label, RouteOrigin origin) {
LOG.info("Adding extra route with destination {}, nextHop {}, label{} and origin {}", destination, nextHop, label, origin);
VpnInstanceOpDataEntry vpnOpEntry = VpnUtil.getVpnInstanceOpData(dataBroker, rd);
Boolean isVxlan = VpnUtil.isL3VpnOverVxLan(vpnOpEntry.getL3vni());
VrfEntry.EncapType encapType = VpnUtil.getEncapType(isVxlan);
addExtraRoute(vpnName, destination, nextHop, rd, routerID, vpnOpEntry.getL3vni(), origin, /*intfName*/
null, null, /*Adjacency*/
encapType, null);
}
Aggregations