use of org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance in project netvirt by opendaylight.
the class InterVpnLinkLocator method getIRTsByVpnName.
private List<String> getIRTsByVpnName(String vpnName) {
String vpn1Rd = VpnUtil.getVpnRd(dataBroker, vpnName);
final VpnInstanceOpDataEntry vpnInstance = VpnUtil.getVpnInstanceOpData(dataBroker, vpn1Rd);
return getRts(vpnInstance, VpnTarget.VrfRTType.ImportExtcommunity);
}
use of org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance in project netvirt by opendaylight.
the class InterVpnLinkLocatorTest method populateL3Vpns.
// ////////////
// Stubbing //
// ////////////
public void populateL3Vpns(DataBroker broker, List<L3VpnComposite> vpns) throws TransactionCommitFailedException {
for (L3VpnComposite vpn : vpns) {
VpnInstance vpnInstance = new VpnInstanceBuilder().setVpnId(vpn.vpnOpData.getVpnId()).setVpnInstanceName(vpn.vpnOpData.getVpnInstanceName()).setVrfId(vpn.vpnOpData.getVrfId()).build();
WriteTransaction writeTx1 = broker.newWriteOnlyTransaction();
writeTx1.merge(LogicalDatastoreType.CONFIGURATION, VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpn.vpnCfgData.getVpnInstanceName()), vpnInstance, true);
writeTx1.submit().checkedGet();
WriteTransaction writeTx2 = broker.newWriteOnlyTransaction();
writeTx2.merge(LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(vpn.vpnOpData.getVrfId()), vpn.vpnOpData, true);
writeTx2.submit().checkedGet();
}
}
use of org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance in project netvirt by opendaylight.
the class VpnServiceTest method createVpnId.
private InstanceIdentifier<VpnInstance> createVpnId(String name) {
InstanceIdentifierBuilder<VpnInstance> idBuilder = InstanceIdentifier.builder(VpnInstances.class).child(VpnInstance.class, new VpnInstanceKey(name));
InstanceIdentifier<VpnInstance> id = idBuilder.build();
return id;
}
use of org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance in project netvirt by opendaylight.
the class VpnServiceTest method test.
@Test
public void test() {
List<VpnTarget> vpnTargetList = new ArrayList<>();
VpnTarget vpneRTarget = new VpnTargetBuilder().setKey(new VpnTargetKey("100:1")).setVrfRTValue("100:1").setVrfRTType(VpnTarget.VrfRTType.ExportExtcommunity).build();
VpnTarget vpniRTarget = new VpnTargetBuilder().setKey(new VpnTargetKey("100:2")).setVrfRTValue("100:2").setVrfRTType(VpnTarget.VrfRTType.ImportExtcommunity).build();
vpnTargetList.add(vpneRTarget);
vpnTargetList.add(vpniRTarget);
VpnTargets vpnTargets = new VpnTargetsBuilder().setVpnTarget(vpnTargetList).build();
Ipv4Family ipv4Family = new Ipv4FamilyBuilder().setRouteDistinguisher(Arrays.asList("100:1", "100:2:")).setVpnTargets(vpnTargets).setApplyLabel(new ApplyLabelBuilder().setApplyLabelMode(new PerRouteBuilder().setApplyLabelPerRoute(true).build()).build()).build();
VpnInstanceBuilder builder = new VpnInstanceBuilder().setKey(new VpnInstanceKey("Vpn1")).setIpv4Family(ipv4Family);
VpnInstance instance = builder.build();
// TODO: Need to enhance the test case to handle ds read/write ops
// vpnManager.onDataChanged(event);
}
use of org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance in project netvirt by opendaylight.
the class VpnSubnetRouteHandlerTest method setupMocks.
private void setupMocks() {
nexthopIp = "10.1.1.25";
idKey = "100:1.10.1.1.24";
poolName = "vpnservices";
elanTag = 2L;
longId = Long.valueOf("100");
nodeConnectorId = buildNodeConnectorId(dpId, 2L);
ipAddress = IpAddressBuilder.getDefaultInstance(nexthopIp);
vpnIntfaces = new VpnInterfacesBuilder().setInterfaceName(interfaceName).setKey(new VpnInterfacesKey(interfaceName)).build();
List<VpnInterfaces> vpnInterfaces = new ArrayList<>();
final List<SubnetToDpn> subToDpn = new ArrayList<>();
final List<Uuid> portList = new ArrayList<>();
final List<PortOpDataEntry> listPortOpDataEntry = new ArrayList<>();
final List<TunnelEndPoints> tunnelEndPoints = new ArrayList<>();
List<Uuid> subnetIdList = new ArrayList<>();
subnetIdList.add(subnetId);
vpnInterfaces.add(vpnIntfaces);
lowerLayerIfList.add(nodeConnectorId.getValue());
portOp = new PortOpDataEntryBuilder().setDpnId(dpId).setKey(new PortOpDataEntryKey(tenantId.getValue())).setSubnetIds(subnetIdList).setPortId(tenantId.getValue()).build();
subnetToDpn = new SubnetToDpnBuilder().setDpnId(dpId).setKey(new SubnetToDpnKey(dpId)).setVpnInterfaces(vpnInterfaces).build();
allocateIdOutput = new AllocateIdOutputBuilder().setIdValue(longId).build();
allocateIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
subToDpn.add(subnetToDpn);
portList.add(portId);
listPortOpDataEntry.add(portOp);
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder ifaceBuilder = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder();
ifaceBuilder.setLowerLayerIf(lowerLayerIfList).setType(L2vlan.class).setAdminStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus.Up).setOperStatus(Interface.OperStatus.Up).setIfIndex(100).setKey(new InterfaceKey(interfaceName)).setName(interfaceName).setPhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress.getDefaultInstance("AA:AA:AA:AA:AA:AA"));
stateInterface = ifaceBuilder.build();
subnetOp = new SubnetOpDataEntryBuilder().setElanTag(elanTag).setNhDpnId(dpId).setSubnetCidr(subnetIp).setSubnetId(subnetId).setKey(new SubnetOpDataEntryKey(subnetId)).setVpnName(interfaceName).setVrfId(primaryRd).setSubnetToDpn(subToDpn).setRouteAdvState(TaskState.Advertised).build();
vpnInstance = new VpnInstanceBuilder().setVpnId(elanTag).setVpnInstanceName(interfaceName).setVrfId(interfaceName).setKey(new VpnInstanceKey(interfaceName)).build();
subnetmap = new SubnetmapBuilder().setSubnetIp(subnetIp).setId(subnetId).setNetworkId(portId).setKey(new SubnetmapKey(subnetId)).setRouterId(portId).setVpnId(subnetId).setTenantId(tenantId).setPortList(portList).build();
portOpData = new PortOpDataBuilder().setPortOpDataEntry(listPortOpDataEntry).build();
dpntePsInfo = new DPNTEPsInfoBuilder().setDPNID(dpId).setUp(true).setKey(new DPNTEPsInfoKey(dpId)).setTunnelEndPoints(tunnelEndPoints).build();
tunlEndPts = new TunnelEndPointsBuilder().setInterfaceName(interfaceName).setVLANID(10).setIpAddress(ipAddress).build();
tunnelEndPoints.add(tunlEndPts);
ipv4Family = new Ipv4FamilyBuilder().setRouteDistinguisher(routeDistinguishers).build();
vpnInstnce = new org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstanceBuilder().setKey(new org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstanceKey(interfaceName)).setVpnInstanceName(interfaceName).setIpv4Family(ipv4Family).build();
networks = new NetworksBuilder().setId(portId).setKey(new NetworksKey(portId)).build();
doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
}
Aggregations