use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class VpnNodeListener method makeTableMissFlow.
private void makeTableMissFlow(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId, int addOrRemove) throws ExecutionException, InterruptedException {
final Uint64 cookieTableMiss = Uint64.valueOf("1030000", 16).intern();
// Instruction to goto L3 InterfaceTable
List<InstructionInfo> instructions = Collections.singletonList(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
List<MatchInfo> matches = new ArrayList<>();
FlowEntity flowEntityLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_LFIB_TABLE, getTableMissFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "Table Miss", 0, 0, cookieTableMiss, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("Invoking MDSAL to install Table Miss Entry");
mdsalManager.addFlow(confTx, flowEntityLfib);
} else {
mdsalManager.removeFlow(confTx, flowEntityLfib);
}
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class VpnNodeListener method add.
@Override
public void add(InstanceIdentifier<Node> identifier, Node add) {
Uint64 dpId = MDSALUtil.getDpnIdFromNodeName(add.getId());
if (!connectedDpnIds.contains(dpId)) {
connectedDpnIds.add(dpId);
}
processNodeAdd(dpId);
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class VpnServiceElanDpnInterfacesListener method add.
@Override
public void add(InstanceIdentifier<DpnInterfaces> identifier, DpnInterfaces dpnInterfaces) {
Uint64 dpnId = dpnInterfaces.getDpId();
String elanInstanceName = identifier.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
ElanInstance elanInstance = vpnUtil.getElanInstanceByName(elanInstanceName);
if (!VpnUtil.isVlan(elanInstance)) {
return;
}
String vpnName = vpnUtil.getVpnNameFromElanIntanceName(elanInstanceName);
if (vpnName == null) {
return;
}
vpnUtil.addRouterPortToElanForVlanInDpn(vpnName, dpnId);
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class VpnInterfaceManager method update.
@Override
public void update(final InstanceIdentifier<VpnInterface> identifier, final VpnInterface original, final VpnInterface update) {
LOG.trace("Received VpnInterface update event: original={}, update={}", original, update);
LOG.info("update: VPN Interface update event - intfName {} on dpn {} oldVpn {} newVpn {}", update.getName(), update.getDpnId(), original.getVpnInstanceNames(), update.getVpnInstanceNames());
if (original.equals(update)) {
LOG.info("update: original {} update {} are same. No update required.", original, update);
return;
}
final String vpnInterfaceName = update.getName();
final Uint64 dpnId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
LOG.info("VPN Interface update event - intfName {}", vpnInterfaceName);
// handles switching between <internal VPN - external VPN>
jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterfaceName, () -> {
List<ListenableFuture<?>> futures = new ArrayList<>();
if (handleVpnInstanceUpdateForVpnInterface(identifier, original, update, futures)) {
LOG.info("update: handled Instance update for VPNInterface {} on dpn {} from oldVpn(s) {} " + "to newVpn(s) {}", original.getName(), dpnId, VpnHelper.getVpnInterfaceVpnInstanceNamesString(new ArrayList<>(original.nonnullVpnInstanceNames().values())), VpnHelper.getVpnInterfaceVpnInstanceNamesString(new ArrayList<>(update.nonnullVpnInstanceNames().values())));
return emptyList();
}
updateVpnInstanceAdjChange(original, update, vpnInterfaceName, futures);
return futures;
});
}
use of org.opendaylight.yangtools.yang.common.Uint64 in project netvirt by opendaylight.
the class SubnetRouteInterfaceStateChangeListener method add.
@Override
public void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
LOG.trace("{} add: Received interface {} up event", LOGGING_PREFIX, intrf);
if (L2vlan.class.equals(intrf.getType())) {
LOG.trace("SubnetRouteInterfaceListener add: Received interface {} up event", intrf);
if (Interface.OperStatus.Up.equals(intrf.getOperStatus())) {
List<Uuid> subnetIdList = getSubnetId(intrf);
if (subnetIdList.isEmpty()) {
LOG.trace("SubnetRouteInterfaceListener add: Port {} doesn't exist in configDS", intrf.getName());
return;
}
for (Uuid subnetId : subnetIdList) {
jobCoordinator.enqueueJob("SUBNETROUTE-" + subnetId, () -> {
String interfaceName = intrf.getName();
Uint64 dpnId = Uint64.ZERO;
LOG.info("{} add: Received port UP event for interface {} subnetId {}", LOGGING_PREFIX, interfaceName, subnetId);
try {
dpnId = InterfaceUtils.getDpIdFromInterface(intrf);
} catch (NullPointerException e) {
LOG.error("{} add: Unable to obtain dpnId for interface {} in subnet {}," + " subnetroute inclusion for this interface failed", LOGGING_PREFIX, interfaceName, subnetId, e);
}
List<ListenableFuture<Void>> futures = new ArrayList<>();
try {
InstanceIdentifier<VpnInterface> id = VpnUtil.getVpnInterfaceIdentifier(interfaceName);
Optional<VpnInterface> cfgVpnInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
if (!cfgVpnInterface.isPresent()) {
return futures;
}
vpnSubnetRouteHandler.onInterfaceUp(dpnId, intrf.getName(), subnetId);
LOG.info("{} add: Processed interface {} up event", LOGGING_PREFIX, intrf.getName());
} catch (InterruptedException | ExecutionException e) {
LOG.error("add: Failed to read data store for interface {} dpn {}", interfaceName, dpnId);
}
return futures;
});
}
}
}
}
Aggregations