use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project netvirt by opendaylight.
the class GeniusProvider method getInterfacesFromNode.
public List<Interfaces> getInterfacesFromNode(NodeId nodeId) {
// getPortsOnBridge() only returns Tunnel ports, so instead using getDpnInterfaceList.
GetDpnInterfaceListInputBuilder inputBuilder = new GetDpnInterfaceListInputBuilder();
inputBuilder.setDpid(BigInteger.valueOf(Long.parseLong(nodeId.getValue().split(":")[1])));
GetDpnInterfaceListInput input = inputBuilder.build();
try {
LOG.debug("getInterfacesFromNode: invoking rpc");
RpcResult<GetDpnInterfaceListOutput> output = interfaceManagerRpcService.getDpnInterfaceList(input).get();
if (!output.isSuccessful()) {
LOG.error("getInterfacesFromNode({}) failed: {}", input, output);
return Collections.emptyList();
}
LOG.debug("getInterfacesFromNode({}) succeeded: {}", input, output);
return output.getResult().getInterfaces();
} catch (InterruptedException | ExecutionException e) {
LOG.error("getInterfacesFromNode failed to retrieve target interface name: ", e);
}
return Collections.emptyList();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project netvirt by opendaylight.
the class TunnelStateChangeListener method populatePolicyRoutesToDpn.
private void populatePolicyRoutesToDpn(StateTunnelList tunnelState, int addOrRemove) {
BigInteger srcDpId = getTepDpnId(tunnelState.getSrcInfo());
BigInteger dstDpId = getTepDpnId(tunnelState.getDstInfo());
String tunnelInterfaceName = tunnelState.getTunnelInterfaceName();
if (BigInteger.ZERO.equals(srcDpId) || BigInteger.ZERO.equals(dstDpId)) {
LOG.warn("No valid DPN found for logical tunnel {}", tunnelInterfaceName);
return;
}
List<PolicyProfile> policyProfiles = policyServiceUtil.getAllPolicyProfiles();
if (policyProfiles == null || policyProfiles.isEmpty()) {
LOG.debug("No policy profiles found on addition of {}", tunnelInterfaceName);
return;
}
policyProfiles.forEach(policyProfile -> {
String policyClassifier = policyProfile.getPolicyClassifier();
List<String> underlayNetworks = PolicyServiceUtil.getUnderlayNetworksFromPolicyRoutes(policyProfile.getPolicyRoute());
underlayNetworks.forEach(underlayNetwork -> {
if (policyServiceUtil.underlayNetworkContainsDpn(underlayNetwork, srcDpId) && policyServiceUtil.underlayNetworkContainsRemoteDpn(underlayNetwork, dstDpId)) {
routeFlowProgrammer.programPolicyClassifierFlow(policyClassifier, srcDpId, dstDpId, addOrRemove, true);
} else {
LOG.trace("logical tunnel {} source DPN {} dest DPN {} not associated to policy classifier {}", tunnelInterfaceName, srcDpId, dstDpId, policyClassifier);
}
});
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project netvirt by opendaylight.
the class TunnelStateChangeListener method unbindService.
private void unbindService(String tunnelInterfaceName) {
coordinator.enqueueJob(tunnelInterfaceName, () -> {
LOG.info("Unbind egress policy service on tunnel {}", tunnelInterfaceName);
BoundServices boundServices = getBoundServices(tunnelInterfaceName, Collections.emptyList());
interfaceManager.unbindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project netvirt by opendaylight.
the class TunnelStateChangeListener method bindService.
private void bindService(String tunnelInterfaceName) {
coordinator.enqueueJob(tunnelInterfaceName, () -> {
LOG.info("Bind egress policy service on tunnel {}", tunnelInterfaceName);
List<Instruction> instructions = Collections.singletonList(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_POLICY_CLASSIFIER_TABLE, 0));
BoundServices boundServices = getBoundServices(tunnelInterfaceName, instructions);
interfaceManager.bindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelBuilder method createTunnels.
static Map<PlspId, PCCTunnel> createTunnels(final String address, final int lsps) {
final Map<PlspId, PCCTunnel> tunnels = new HashMap<>();
for (int i = 1; i <= lsps; i++) {
final PCCTunnel tunnel = new PCCTunnel(MsgBuilderUtil.getDefaultPathName(address, i), PCC_DELEGATION, LspType.PCC_LSP, createPath(Lists.newArrayList(DEFAULT_ENDPOINT_HOP)));
tunnels.put(new PlspId((long) i), tunnel);
}
return tunnels;
}
Aggregations