use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.vpn.to.pseudo.port.list.VpnToPseudoPortData in project netvirt by opendaylight.
the class AddVpnPseudoPortDataJob method call.
@Override
public List<ListenableFuture<Void>> call() {
LOG.debug("Adding VpnToPseudoPortMap: vpnRd={} vpnPseudoLportTag={} scfTag={} scfTable={}", super.vpnRd, vpnPseudoLportTag, scfTag, scfTableIdToGo);
VpnToPseudoPortData newValue = new VpnToPseudoPortDataBuilder().setKey(new VpnToPseudoPortDataKey(super.vpnRd)).setVrfId(super.vpnRd).setScfTableId(scfTableIdToGo).setScfTag(scfTag).setVpnLportTag(vpnPseudoLportTag).build();
LOG.trace("Adding lportTag={} to VpnToLportTag map for VPN with rd={}", vpnPseudoLportTag, vpnRd);
InstanceIdentifier<VpnToPseudoPortData> path = VpnServiceChainUtils.getVpnToPseudoPortTagIid(vpnRd);
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.put(LogicalDatastoreType.CONFIGURATION, path, newValue, WriteTransaction.CREATE_MISSING_PARENTS)));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.vpn.to.pseudo.port.list.VpnToPseudoPortData in project netvirt by opendaylight.
the class CloudScVpnInterfaceListener method add.
@Override
protected void add(InstanceIdentifier<VpnInterface> key, VpnInterface vpnIfaceAdded) {
for (VpnInstanceNames vpnInstance : vpnIfaceAdded.getVpnInstanceNames()) {
String vpnName = vpnInstance.getVpnName();
if (!vpnInstance.getAssociatedSubnetType().equals(AssociatedSubnetType.V4AndV6Subnets) && !vpnInstance.getAssociatedSubnetType().equals(AssociatedSubnetType.V4Subnet)) {
continue;
}
try {
Optional<VpnToPseudoPortData> optScfInfoForVpn = vpnScHandler.getScfInfoForVpn(vpnName);
if (!optScfInfoForVpn.isPresent()) {
LOG.trace("Vpn {} is not related to ServiceChaining. No further action", vpnName);
return;
}
vpnScHandler.bindScfOnVpnInterface(vpnIfaceAdded.getKey().getName(), optScfInfoForVpn.get().getScfTag());
} catch (ReadFailedException e) {
LOG.error("Error reading the SFC information for VPN {}", vpnName, e);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.vpn.to.pseudo.port.list.VpnToPseudoPortData in project netvirt by opendaylight.
the class VpnToDpnListener method programVpnScfFlowsOnDpn.
private void programVpnScfFlowsOnDpn(BigInteger dpnId, String vpnName, String rd, int addOrRemove) {
String addedOrRemovedTxt = addOrRemove == NwConstants.ADD_FLOW ? " added " : " removed";
LOG.debug("DpnToVpn {} event received: dpn={} vpn={} rd={}", addedOrRemovedTxt, dpnId, vpnName, rd);
if (dpnId == null) {
LOG.warn("Dpn to Vpn {} event received, but no DPN specified in event", addedOrRemovedTxt);
return;
}
if (vpnName == null) {
LOG.warn("Dpn to Vpn {} event received, but no VPN specified in event", addedOrRemovedTxt);
return;
}
if (rd == null) {
LOG.warn("Dpn to Vpn {} event received, but no RD specified in event", addedOrRemovedTxt);
return;
}
try {
Optional<VpnToPseudoPortData> optVpnToPseudoPortInfo = VpnServiceChainUtils.getVpnPseudoPortData(broker, rd);
if (!optVpnToPseudoPortInfo.isPresent()) {
LOG.debug("Dpn to Vpn {} event received: Could not find VpnPseudoLportTag for VPN name={} rd={}", addedOrRemovedTxt, vpnName, rd);
return;
}
VpnToPseudoPortData vpnToPseudoPortInfo = optVpnToPseudoPortInfo.get();
// Vpn2Scf flows (LFIB + LportDispatcher)
// TODO: Should we filter out by bgp origin
List<VrfEntry> allVpnVrfEntries = VpnServiceChainUtils.getAllVrfEntries(broker, rd);
vpnScHandler.programVpnToScfPipelineOnDpn(dpnId, allVpnVrfEntries, vpnToPseudoPortInfo.getScfTableId(), vpnToPseudoPortInfo.getScfTag(), vpnToPseudoPortInfo.getVpnLportTag().intValue(), addOrRemove);
// Scf2Vpn flow (LportDispatcher)
long vpnId = addOrRemove == NwConstants.ADD_FLOW ? VpnServiceChainUtils.getVpnId(broker, vpnName) : CloudServiceChainConstants.INVALID_VPN_TAG;
VpnServiceChainUtils.programLPortDispatcherFlowForScfToVpn(mdsalMgr, vpnId, dpnId, vpnToPseudoPortInfo.getVpnLportTag().intValue(), addOrRemove);
} catch (ReadFailedException e) {
LOG.error("Error retrieving the VPN to pseudo-port data for {}", rd, e);
}
}
Aggregations