Search in sources :

Example 96 with Object

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);
}
Also used : MappingEntry(org.opendaylight.lispflowmapping.interfaces.dao.MappingEntry) Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Example 97 with Object

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());
}
Also used : MappingEntry(org.opendaylight.lispflowmapping.interfaces.dao.MappingEntry) Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 98 with Object

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());
}
Also used : MappingEntry(org.opendaylight.lispflowmapping.interfaces.dao.MappingEntry) Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 99 with Object

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));
        }
    }
}
Also used : ItmTepRemoveWorker(org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker) HwVtep(org.opendaylight.genius.itm.confighelpers.HwVtep) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)

Example 100 with Object

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);
            }
        }
    }
}
Also used : TepsInNotHostedTransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone) UnknownVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVteps)

Aggregations

ArrayList (java.util.ArrayList)94 ByteBuf (io.netty.buffer.ByteBuf)82 Test (org.junit.Test)62 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)34 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)33 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)33 ExecutionException (java.util.concurrent.ExecutionException)30 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)29 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)25 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)25 List (java.util.List)21 HashMap (java.util.HashMap)19 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)18 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)17 Nullable (org.eclipse.jdt.annotation.Nullable)16 UnknownObject (org.opendaylight.protocol.pcep.spi.UnknownObject)16 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)15 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)15 FutureCallback (com.google.common.util.concurrent.FutureCallback)14 BigInteger (java.math.BigInteger)14