use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project lispflowmapping by opendaylight.
the class HashMapDbTest method testGetBest_withIpPrefix.
/**
* Test {@link HashMapDb#getBest} with IP prefix.
*/
@Test
public void testGetBest_withIpPrefix() throws Exception {
final Eid ipv4PrefixEid1 = LispAddressUtil.asIpv4PrefixBinaryEid("192.168.0.0" + "/16");
final Eid ipv4PrefixEid2 = LispAddressUtil.asIpv4PrefixBinaryEid("192.169.0.0" + "/16");
final Eid ipv4PrefixEid3 = LispAddressUtil.asIpv4PrefixBinaryEid("192.168.1.1" + "/32");
final String mapSubKey1 = "mapSubKey1";
final String mapSubKey2 = "mapSubKey2";
final String mapValue1 = "mapValue1";
final String mapValue2 = "mapValue2";
final MappingEntry<Object> mapEntry1 = new MappingEntry<>(mapSubKey1, mapValue1);
final MappingEntry<Object> mapEntry2 = new MappingEntry<>(mapSubKey2, mapValue2);
map.put(ipv4PrefixEid1, mapEntry1);
map.put(ipv4PrefixEid2, mapEntry2);
Map<String, ?> res = map.getBest(ipv4PrefixEid3);
Assert.assertEquals(Collections.<String, Object>singletonMap(mapSubKey1, mapValue1), res);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project lispflowmapping by opendaylight.
the class HashMapDbTest method testGetBestPair_withIpPrefix.
/**
* Test {@link HashMapDb#getBestPair} with IP prefix.
*/
@Test
public void testGetBestPair_withIpPrefix() throws Exception {
final Eid ipv4PrefixEid1 = LispAddressUtil.asIpv4PrefixBinaryEid("192.168.0.0" + "/16");
final Eid ipv4PrefixEid2 = LispAddressUtil.asIpv4PrefixBinaryEid("192.169.0.0" + "/16");
final Eid ipv4PrefixEid3 = LispAddressUtil.asIpv4PrefixBinaryEid("192.168.1.1" + "/32");
final String mapSubKey1 = "mapSubKey1";
final String mapSubKey2 = "mapSubKey2";
final String mapValue1 = "mapValue1";
final String mapValue2 = "mapValue2";
final MappingEntry<Object> mapEntry1 = new MappingEntry<>(mapSubKey1, mapValue1);
final MappingEntry<Object> mapEntry2 = new MappingEntry<>(mapSubKey2, mapValue2);
map.put(ipv4PrefixEid1, mapEntry1);
map.put(ipv4PrefixEid2, mapEntry2);
SimpleImmutableEntry<Eid, Map<String, ?>> res = map.getBestPair(ipv4PrefixEid3);
Assert.assertEquals(ipv4PrefixEid1, res.getKey());
Assert.assertEquals(Collections.<String, Object>singletonMap(mapSubKey1, mapValue1), res.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project lispflowmapping by opendaylight.
the class HashMapDbTest method testGetBestPair_withNonIpPrefix.
/**
* Test {@link HashMapDb#getBestPair} with non-IP prefix.
*/
@Test
public void testGetBestPair_withNonIpPrefix() throws Exception {
final Eid mac1 = LispAddressUtil.asMacEid("01:02:03:04:05:06");
final Eid mac2 = LispAddressUtil.asMacEid("01:02:03:04:05:07");
final String mapSubKey1 = "mapSubKey1";
final String mapSubKey2 = "mapSubKey2";
final String mapValue1 = "mapValue1";
final String mapValue2 = "mapValue2";
final MappingEntry<Object> mapEntry1 = new MappingEntry<>(mapSubKey1, mapValue1);
final MappingEntry<Object> mapEntry2 = new MappingEntry<>(mapSubKey2, mapValue2);
map.put(mac1, mapEntry1);
map.put(mac2, mapEntry2);
SimpleImmutableEntry<Eid, Map<String, ?>> res = map.getBestPair(mac1);
Assert.assertEquals(mac1, res.getKey());
Assert.assertEquals(Collections.<String, Object>singletonMap(mapSubKey1, mapValue1), res.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project genius by opendaylight.
the class TransportZoneListener method remove.
@Override
public void remove(@Nonnull TransportZone transportZone) {
LOG.debug("Received Transport Zone Remove Event: {}", transportZone);
boolean allowTunnelDeletion;
// due to change in def-tz-tunnel-type, then allow def-tz tunnels deletion
if (transportZone.getZoneName().equalsIgnoreCase(ITMConstants.DEFAULT_TRANSPORT_ZONE)) {
// Get TunnelTypeBase object for tunnel-type configured in config file
Class<? extends TunnelTypeBase> tunType = ItmUtils.getTunnelType(itmConfig.getDefTzTunnelType());
if (!itmConfig.isDefTzEnabled() || !transportZone.getTunnelType().equals(tunType)) {
allowTunnelDeletion = true;
} else {
// this is case when def-tz removal request is from Northbound.
allowTunnelDeletion = false;
LOG.error("Deletion of {} is an incorrect usage", ITMConstants.DEFAULT_TRANSPORT_ZONE);
}
} else {
allowTunnelDeletion = true;
}
if (allowTunnelDeletion) {
// TODO : DPList code can be refactor with new specific class
// which implement TransportZoneValidator
List<DPNTEPsInfo> opDpnList = createDPNTepInfo(transportZone);
List<HwVtep> hwVtepList = createhWVteps(transportZone);
LOG.trace("Delete: Invoking deleteTunnels in ItmManager with DpnList {}", opDpnList);
if (!opDpnList.isEmpty() || !hwVtepList.isEmpty()) {
LOG.trace("Delete: Invoking ItmManager with hwVtep List {} ", hwVtepList);
jobCoordinator.enqueueJob(transportZone.getZoneName(), new ItmTepRemoveWorker(opDpnList, hwVtepList, transportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project genius by opendaylight.
the class OvsdbTepRemoveConfigHelper method removeUnknownTzTepFromTepsNotHosted.
/**
* Removes the TEP from the not-hosted transport zone in the TepsNotHosted list
* from ITM Operational Datastore.
*
* @param tzName transport zone name in string
* @param tepIpAddress TEP IP address in IpAddress object
* @param dpnId bridge datapath ID in BigInteger
* @param dataBroker data broker handle to perform operations on operational datastore
* @param wrTx WriteTransaction object
*/
public static void removeUnknownTzTepFromTepsNotHosted(String tzName, IpAddress tepIpAddress, BigInteger dpnId, DataBroker dataBroker, WriteTransaction wrTx) {
List<UnknownVteps> vtepList = null;
TepsInNotHostedTransportZone tepsInNotHostedTransportZone = ItmUtils.getUnknownTransportZoneFromITMOperDS(tzName, dataBroker);
if (tepsInNotHostedTransportZone == null) {
LOG.trace("Unhosted TransportZone ({}) does not exist in OperDS. Nothing to do for TEP removal.", tzName);
return;
} else {
vtepList = tepsInNotHostedTransportZone.getUnknownVteps();
if (vtepList == null || vtepList.isEmpty()) {
// case: vtep list does not exist or it has no elements
LOG.trace("Remove TEP from unhosted TZ ({}) when no vtep-list in the TZ. Nothing to do.", tzName);
} else {
// case: vtep list has elements
boolean vtepFound = false;
UnknownVteps foundVtep = null;
for (UnknownVteps vtep : vtepList) {
if (vtep.getDpnId().equals(dpnId)) {
vtepFound = true;
foundVtep = vtep;
break;
}
}
if (vtepFound) {
// vtep is found, update it with tep-ip
LOG.trace("Remove TEP with IP ({}) from unhosted TZ ({}) inside not-hosted-transport-zones list.", tepIpAddress, tzName);
if (vtepList.size() == 1) {
removeTzFromTepsNotHosted(tzName, wrTx);
} else {
removeVtepFromTepsNotHosted(tzName, dpnId, wrTx);
}
vtepList.remove(foundVtep);
}
}
}
}
Aggregations