use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path in project netvirt by opendaylight.
the class AclServiceUtils method getDpnForInterface.
/**
* Get the data path number for the interface.
* @param interfaceManagerRpcService interfaceManagerRpcService instance.
* @param ifName the interface name.
* @return the dpn.
*/
public static BigInteger getDpnForInterface(OdlInterfaceRpcService interfaceManagerRpcService, String ifName) {
BigInteger nodeId = BigInteger.ZERO;
try {
GetDpidFromInterfaceInput dpIdInput = new GetDpidFromInterfaceInputBuilder().setIntfName(ifName).build();
Future<RpcResult<GetDpidFromInterfaceOutput>> dpIdOutput = interfaceManagerRpcService.getDpidFromInterface(dpIdInput);
RpcResult<GetDpidFromInterfaceOutput> dpIdResult = dpIdOutput.get();
if (dpIdResult.isSuccessful()) {
nodeId = dpIdResult.getResult().getDpid();
} else {
LOG.error("Could not retrieve DPN Id for interface {}", ifName);
}
} catch (NullPointerException | InterruptedException | ExecutionException e) {
LOG.error("Exception when getting dpn for interface {}", ifName, e);
}
return nodeId;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path in project netvirt by opendaylight.
the class NodeConnectedHandlerUtils method addPsNode.
CheckedFuture<Void, TransactionCommitFailedException> addPsNode(InstanceIdentifier<Node> path, InstanceIdentifier<Node> parentPath, List<String> portNameList, WriteTransaction transaction) throws Exception {
NodeBuilder nodeBuilder = null;
nodeBuilder = prepareOperationalNode(path);
PhysicalSwitchAugmentationBuilder physicalSwitchAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
physicalSwitchAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(parentPath));
physicalSwitchAugmentationBuilder.setPhysicalSwitchUuid(getUUid("d1s3"));
physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName("s3"));
physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");
List<TunnelIps> tunnelIps = new ArrayList<>();
IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
tunnelIps.add(new TunnelIpsBuilder().setKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
PhysicalSwitchHelper.dId = parentPath;
nodeBuilder.setTerminationPoint(PhysicalSwitchHelper.addPhysicalSwitchTerminationPoints(path, transaction, portNameList));
return TestUtil.submitNode(OPERATIONAL, path, nodeBuilder.build(), transaction);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method chooseDpn.
/**
* Choose a dpn among the list of elanDpns such that it has lowest count of being the designated dpn.
* @param tunnelIp The tunnel Ip address
* @param elanInstanceName The elan instance name
* @param dpns The data path nodes
* @return The designated dpn
*/
private BigInteger chooseDpn(IpAddress tunnelIp, String elanInstanceName, List<BigInteger> dpns) {
BigInteger designatedDpnId = DhcpMConstants.INVALID_DPID;
if (dpns != null && dpns.size() != 0) {
List<BigInteger> candidateDpns = DhcpServiceUtils.getDpnsForElan(elanInstanceName, broker);
candidateDpns.retainAll(dpns);
LOG.trace("Choosing new dpn for tunnelIp {}, elanInstanceName {}, among elanDpns {}", tunnelIp, elanInstanceName, candidateDpns);
boolean elanDpnAvailableFlag = true;
if (candidateDpns.isEmpty()) {
candidateDpns = dpns;
elanDpnAvailableFlag = false;
}
int size = 0;
L2GatewayDevice device = getDeviceFromTunnelIp(tunnelIp);
if (device == null) {
LOG.trace("Could not find any device for elanInstanceName {} and tunnelIp {}", elanInstanceName, tunnelIp);
handleUnableToDesignateDpn(tunnelIp, elanInstanceName);
return designatedDpnId;
}
for (BigInteger dpn : candidateDpns) {
String hwvtepNodeId = device.getHwvtepNodeId();
if (!elanDpnAvailableFlag) {
if (!isTunnelConfigured(dpn, hwvtepNodeId)) {
LOG.trace("Tunnel is not configured on dpn {} to TOR {}", dpn, hwvtepNodeId);
continue;
}
} else if (!isTunnelUp(hwvtepNodeId, dpn)) {
LOG.trace("Tunnel is not up between dpn {} and TOR {}", dpn, hwvtepNodeId);
continue;
}
Set<Pair<IpAddress, String>> tunnelIpElanNameSet = designatedDpnsToTunnelIpElanNameCache.get(dpn);
if (tunnelIpElanNameSet == null) {
designatedDpnId = dpn;
break;
}
if (size == 0 || tunnelIpElanNameSet.size() < size) {
size = tunnelIpElanNameSet.size();
designatedDpnId = dpn;
}
}
writeDesignatedSwitchForExternalTunnel(designatedDpnId, tunnelIp, elanInstanceName);
return designatedDpnId;
}
handleUnableToDesignateDpn(tunnelIp, elanInstanceName);
return designatedDpnId;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path in project netvirt by opendaylight.
the class ElanServiceChainUtils method getElanServiceChainState.
/**
* Read from ElanToLportTagMap the PsuedoLogicalPort related with a given elan.
*
* @param broker dataBroker service reference
* @param elanInstanceName the name of the Elan
* @return the ElanToPseudoPortData object or Optional.absent() if it
* cannot be found
*/
public static Optional<ElanServiceChainState> getElanServiceChainState(final DataBroker broker, final String elanInstanceName) {
InstanceIdentifier<ElanServiceChainState> path = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).augmentation(ElanServiceChainState.class).build();
Optional<ElanServiceChainState> elanServiceChainStateOpc = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, path);
return elanServiceChainStateOpc;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path 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)));
}
Aggregations