use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class EvpnVrfEntryHandler method createFlows.
@Override
public void createFlows(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
LOG.info("Initiating creation of Evpn Flows");
final VrfTablesKey vrfTableKey = identifier.firstKeyOf(VrfTables.class);
final VpnInstanceOpDataEntry vpnInstance = getFibUtil().getVpnInstanceOpData(vrfTableKey.getRouteDistinguisher()).get();
Long vpnId = vpnInstance.getVpnId();
Preconditions.checkNotNull(vpnInstance, "Vpn Instance not available " + vrfTableKey.getRouteDistinguisher());
Preconditions.checkNotNull(vpnId, "Vpn Instance with rd " + vpnInstance.getVrfId() + " has null vpnId!");
if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.CONNECTED) {
SubnetRoute subnetRoute = vrfEntry.getAugmentation(SubnetRoute.class);
final List<VpnToDpnList> vpnToDpnList = vpnInstance.getVpnToDpnList();
final long elanTag = subnetRoute.getElantag();
LOG.trace("SubnetRoute augmented vrfentry found for rd {} prefix {} with elantag {}", rd, vrfEntry.getDestPrefix(), elanTag);
if (vpnToDpnList != null) {
jobCoordinator.enqueueJob("FIB-" + rd + "-" + vrfEntry.getDestPrefix(), () -> {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
for (final VpnToDpnList curDpn : vpnToDpnList) {
if (curDpn.getDpnState() == VpnToDpnList.DpnState.Active) {
vrfEntryListener.installSubnetRouteInFib(curDpn.getDpnId(), elanTag, rd, vpnId, vrfEntry, tx);
}
}
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(tx.submit());
return futures;
});
}
return;
}
Prefixes localNextHopInfo = getFibUtil().getPrefixToInterface(vpnInstance.getVpnId(), vrfEntry.getDestPrefix());
List<BigInteger> localDpnId = new ArrayList<>();
boolean isNatPrefix = false;
if (Prefixes.PrefixCue.Nat.equals(localNextHopInfo.getPrefixCue())) {
LOG.info("NAT Prefix {} with vpnId {} rd {}. Skip local dpn {} FIB processing", vrfEntry.getDestPrefix(), vpnId, rd, localNextHopInfo.getDpnId());
localDpnId.add(localNextHopInfo.getDpnId());
isNatPrefix = true;
} else {
localDpnId = createLocalEvpnFlows(vpnInstance.getVpnId(), rd, vrfEntry, localNextHopInfo);
}
createRemoteEvpnFlows(rd, vrfEntry, vpnInstance, localDpnId, vrfTableKey, isNatPrefix);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class TestComparators method assertTerminationPoint.
public static void assertTerminationPoint(List<String> terminationPointNames, InstanceIdentifier<Node> d1ps, InstanceIdentifier<Node> haPsa, ReadWriteTransaction readWriteTransaction, Node nodeD, Node nodeHa) throws ReadFailedException {
for (String portName : terminationPointNames) {
InstanceIdentifier<TerminationPoint> tpPathd = d1ps.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
TerminationPoint tpNoded = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathd).checkedGet().get();
HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationD = tpNoded.getAugmentation(HwvtepPhysicalPortAugmentation.class);
InstanceIdentifier<TerminationPoint> tpPathha = haPsa.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
TerminationPoint tpNodeha = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathha).checkedGet().get();
HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationHa = tpNodeha.getAugmentation(HwvtepPhysicalPortAugmentation.class);
assertEquals("Termination point hwvtep-node-name should be same", hwvtepPhysicalPortAugmentationD.getHwvtepNodeName(), hwvtepPhysicalPortAugmentationHa.getHwvtepNodeName());
List<VlanBindings> vlanBindingsesD = hwvtepPhysicalPortAugmentationD.getVlanBindings();
List<VlanBindings> vlanBindingsesHa = hwvtepPhysicalPortAugmentationHa.getVlanBindings();
assertEquals("Size of VlanBindings should be same", vlanBindingsesD.size(), vlanBindingsesHa.size());
List<Integer> vlanKeysD = new ArrayList<>();
List<Integer> vlanKeysHa = new ArrayList<>();
String logicalSwitchRefD = new String();
String logicalSwitchRefHa = new String();
List<String> logicalSwitchNameD = new ArrayList<>();
List<String> logicalSwitchNameHa = new ArrayList<>();
if (vlanBindingsesD.size() == vlanBindingsesHa.size()) {
for (int i = 0; i < vlanBindingsesD.size(); i++) {
vlanKeysD.add(vlanBindingsesD.get(i).getVlanIdKey().getValue());
logicalSwitchRefD = vlanBindingsesD.get(i).getLogicalSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
logicalSwitchNameD.add(vlanBindingsesD.get(i).getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
vlanKeysHa.add(vlanBindingsesHa.get(i).getVlanIdKey().getValue());
logicalSwitchRefHa = vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
logicalSwitchNameHa.add(vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
}
assertTrue(vlanKeysD.containsAll(vlanKeysHa));
assertTrue(logicalSwitchRefD.equals(nodeD.getNodeId().getValue()));
assertTrue(logicalSwitchRefHa.equals(nodeHa.getNodeId().getValue()));
assertTrue(logicalSwitchNameD.containsAll(logicalSwitchNameHa));
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class ElanServiceTestModule method configureBindings.
@Override
protected void configureBindings() {
DataBroker dataBroker = DataBrokerTestModule.dataBroker();
bind(EntityOwnershipService.class).toInstance(Mockito.mock(EntityOwnershipService.class));
bind(INeutronVpnManager.class).toInstance(Mockito.mock(NeutronvpnManagerImpl.class));
IVpnManager ivpnManager = Mockito.mock(VpnManagerTestImpl.class, CALLS_REAL_METHODS);
bind(IMdsalApiManager.class).toInstance(new MDSALManager(dataBroker, Mockito.mock(PacketProcessingService.class)));
// Bindings for external services to "real" implementations
bind(LockManagerService.class).to(LockManagerServiceImpl.class);
bind(ElanConfig.class).toInstance(new ElanConfigBuilder().setIntBridgeGenMac(true).setTempSmacLearnTimeout(10).build());
// Bindings of all listeners (which are not directly referenced in the code)
// This is required to be explicit here, because these are referenced neither from src/main nor src/test
// and we, intentionally, don't use "classpath scanning for auto-discovery"
// so this list must kept, manually, in line with the rc/main/resources/org/opendaylight/blueprint/*.xml
// and target/generated-resources/org/opendaylight/blueprint/autowire.xml
// bind(ElanGroupListener.class);
// TODO complete this list!!! after Gerrit which adds @Inject to all listeners
// Bindings to test infra (fakes & mocks)
TestInterfaceManager obj = TestInterfaceManager.newInstance(dataBroker);
ItmRpcService itmRpcService = new ItmRpcTestImpl();
bind(DataBroker.class).toInstance(dataBroker);
bind(DataBroker.class).annotatedWith(OsgiService.class).toInstance(dataBroker);
bind(IdManagerService.class).toInstance(Mockito.mock(IdHelper.class, CALLS_REAL_METHODS));
bind(IInterfaceManager.class).toInstance(obj);
bind(TestInterfaceManager.class).toInstance(obj);
InterfaceMetaUtils interfaceMetaUtils = new InterfaceMetaUtils(dataBroker, Mockito.mock(IdHelper.class, CALLS_REAL_METHODS), Mockito.mock(BatchingUtils.class));
InterfaceManagerCommonUtils interfaceManagerCommonUtils = new InterfaceManagerCommonUtils(dataBroker, new MDSALManager(dataBroker, Mockito.mock(PacketProcessingService.class)), Mockito.mock(IdHelper.class, CALLS_REAL_METHODS), interfaceMetaUtils, Mockito.mock(BatchingUtils.class));
bind(OdlInterfaceRpcService.class).toInstance(ElanEgressActionsHelper.newInstance(interfaceManagerCommonUtils));
SingleTransactionDataBroker singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
bind(SingleTransactionDataBroker.class).toInstance(singleTransactionDataBroker);
IBgpManager ibgpManager = BgpManagerTestImpl.newInstance(singleTransactionDataBroker);
bind(ItmRpcService.class).toInstance(itmRpcService);
bind(ItmRpcTestImpl.class).toInstance((ItmRpcTestImpl) itmRpcService);
bind(DataImportBootReady.class).annotatedWith(OsgiService.class).toInstance(new DataImportBootReady() {
});
bind(DiagStatusService.class).toInstance(Mockito.mock(DiagStatusService.class));
bind(IVpnManager.class).toInstance(ivpnManager);
bind(IBgpManager.class).toInstance(ibgpManager);
bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {
});
bind(IElanService.class).to(ElanServiceProvider.class);
MdsalUtils mdsalUtils = new MdsalUtils(dataBroker);
bind(MdsalUtils.class).toInstance(mdsalUtils);
bind(SouthboundUtils.class).toInstance(new SouthboundUtils(mdsalUtils));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class Ipv6NeighborSolicitation method transmitNeighborSolicitation.
public boolean transmitNeighborSolicitation(BigInteger dpnId, NodeConnectorRef nodeRef, MacAddress srcMacAddress, Ipv6Address srcIpv6Address, Ipv6Address targetIpv6Address) {
byte[] txPayload = frameNeighborSolicitationRequest(srcMacAddress, srcIpv6Address, targetIpv6Address);
NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd");
TransmitPacketInput input = new TransmitPacketInputBuilder().setPayload(txPayload).setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:" + dpnId))).toInstance())).setEgress(nodeRef).setIngress(nodeConnectorRef).build();
// Tx the packet out of the controller.
LOG.debug("Transmitting the Neighbor Solicitation packet out on {}", dpnId);
JdkFutures.addErrorLogging(packetService.transmitPacket(input), LOG, "transmitPacket");
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class IVpnLinkServiceImpl method leakExtraRoutesToVpnEndpoint.
/*
* Checks if there are static routes in Vpn1 whose nexthop is Vpn2's endpoint.
* Those routes must be leaked to Vpn1.
*
* @param vpnLink
* @param vpn1Uuid
* @param vpn2Uuid
*/
private void leakExtraRoutesToVpnEndpoint(InterVpnLinkDataComposite vpnLink, String vpn1Uuid, String vpn2Uuid) {
String vpn1Rd = VpnUtil.getVpnRd(dataBroker, vpn1Uuid);
String vpn2Endpoint = vpnLink.getOtherEndpointIpAddr(vpn2Uuid);
List<VrfEntry> allVpnVrfEntries = VpnUtil.getAllVrfEntries(dataBroker, vpn1Rd);
for (VrfEntry vrfEntry : allVpnVrfEntries) {
vrfEntry.getRoutePaths().stream().filter(routePath -> routePath.getNexthopAddress().equals(vpn2Endpoint)).forEach(routePath -> {
// Vpn1 has a route pointing to Vpn2's endpoint. Forcing the leaking of the route will update
// the BGP accordingly
long label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(vpn1Rd, vrfEntry.getDestPrefix()));
if (label == VpnConstants.INVALID_LABEL) {
LOG.error("Unable to fetch label from Id Manager. Bailing out of leaking extra routes for " + "InterVpnLink {} rd {} prefix {}", vpnLink.getInterVpnLinkName(), vpn1Rd, vrfEntry.getDestPrefix());
} else {
leakRoute(vpnLink, vpn2Uuid, vpn1Uuid, vrfEntry.getDestPrefix(), label, RouteOrigin.value(vrfEntry.getOrigin()));
}
});
}
}
Aggregations