Search in sources :

Example 1 with TunnelMonitorInterval

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval in project genius by opendaylight.

the class TunnelMonitorIntervalListener method remove.

@Override
protected void remove(InstanceIdentifier<TunnelMonitorInterval> key, TunnelMonitorInterval dataObjectModification) {
    LOG.debug("remove TunnelMonitorIntervalListener called with {}", dataObjectModification.getInterval());
    InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
    Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
    if (transportZonesOptional.isPresent()) {
        TransportZones tzones = transportZonesOptional.get();
        for (TransportZone tzone : tzones.getTransportZone()) {
            // if you remove configuration, the last configured interval is only set i.e no change
            LOG.debug("Remove:Calling TunnelMonitorIntervalWorker with tzone = {} and {}", tzone.getZoneName(), dataObjectModification.getInterval());
            ItmMonitorIntervalWorker toggleWorker = new ItmMonitorIntervalWorker(tzone.getZoneName(), dataObjectModification.getInterval(), broker);
            jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
        }
    }
}
Also used : TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) ItmMonitorIntervalWorker(org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)

Example 2 with TunnelMonitorInterval

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval in project genius by opendaylight.

the class TunnelMonitorIntervalListener method update.

@Override
protected void update(InstanceIdentifier<TunnelMonitorInterval> key, TunnelMonitorInterval dataObjectModificationBefore, TunnelMonitorInterval dataObjectModificationAfter) {
    LOG.debug("update TunnelMonitorIntervalListener called with {}", dataObjectModificationAfter.getInterval());
    InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
    Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
    if (transportZonesOptional.isPresent()) {
        TransportZones tzones = transportZonesOptional.get();
        for (TransportZone tzone : tzones.getTransportZone()) {
            LOG.debug("Update:Calling TunnelMonitorIntervalWorker with tzone = {} and {}", tzone.getZoneName(), dataObjectModificationAfter.getInterval());
            ItmMonitorIntervalWorker intervalWorker = new ItmMonitorIntervalWorker(tzone.getZoneName(), dataObjectModificationAfter.getInterval(), broker);
            jobCoordinator.enqueueJob(tzone.getZoneName(), intervalWorker);
        }
    }
}
Also used : TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) ItmMonitorIntervalWorker(org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)

Example 3 with TunnelMonitorInterval

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval in project genius by opendaylight.

the class ItmMonitorIntervalWorker method toggleTunnelMonitoring.

private void toggleTunnelMonitoring(WriteTransaction transaction) {
    List<String> tunnelList = ItmUtils.getInternalTunnelInterfaces(dataBroker);
    LOG.debug("ItmMonitorIntervalWorker toggleTunnelMonitoring: List of tunnel interfaces: {}", tunnelList);
    InstanceIdentifier<TunnelMonitorInterval> iid = InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
    TunnelMonitorInterval intervalBuilder = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
    ItmUtils.asyncUpdate(LogicalDatastoreType.OPERATIONAL, iid, intervalBuilder, dataBroker, ItmUtils.DEFAULT_CALLBACK);
    for (String tunnel : tunnelList) {
        toggle(tunnel, transaction);
    }
}
Also used : TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder) TunnelMonitorInterval(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval)

Example 4 with TunnelMonitorInterval

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval in project genius by opendaylight.

the class TepCommandHelper method configureTunnelMonitorInterval.

public void configureTunnelMonitorInterval(int interval) {
    InstanceIdentifier<TunnelMonitorInterval> path = InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
    Optional<TunnelMonitorInterval> storedTunnelMonitor = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
    if (!storedTunnelMonitor.isPresent() || storedTunnelMonitor.get().getInterval() != interval) {
        TunnelMonitorInterval tunnelMonitor = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
        ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, tunnelMonitor, dataBroker, ItmUtils.DEFAULT_CALLBACK);
    }
}
Also used : TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder) TunnelMonitorInterval(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval)

Example 5 with TunnelMonitorInterval

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval in project genius by opendaylight.

the class ItmInternalTunnelAddTest method setupMocks.

private void setupMocks() {
    ipAddress1 = IpAddressBuilder.getDefaultInstance(tepIp1);
    ipAddress2 = IpAddressBuilder.getDefaultInstance(tepIp2);
    ipPrefixTest = IpPrefixBuilder.getDefaultInstance(subnetIp + "/24");
    gtwyIp1 = IpAddressBuilder.getDefaultInstance(gwyIp1);
    gtwyIp2 = IpAddressBuilder.getDefaultInstance(gwyIp2);
    tunnelEndPointsVxlan = new TunnelEndPointsBuilder().setVLANID(vlanId).setPortname(portName1).setIpAddress(ipAddress1).setGwIpAddress(gtwyIp1).setInterfaceName(parentInterfaceName).setTzMembership(ItmUtils.createTransportZoneMembership(transportZone1)).setTunnelType(tunnelType1).setSubnetMask(ipPrefixTest).build();
    tunnelEndPointsVxlanNew = new TunnelEndPointsBuilder().setVLANID(vlanId).setPortname(portName2).setIpAddress(ipAddress2).setGwIpAddress(gtwyIp2).setInterfaceName(parentInterfaceName).setTzMembership(ItmUtils.createTransportZoneMembership(transportZone1)).setTunnelType(tunnelType1).setSubnetMask(ipPrefixTest).build();
    tunnelEndPointsGre = new TunnelEndPointsBuilder().setVLANID(vlanId).setPortname(portName1).setIpAddress(ipAddress1).setGwIpAddress(gtwyIp1).setInterfaceName(parentInterfaceName).setTzMembership(ItmUtils.createTransportZoneMembership(transportZone1)).setTunnelType(tunnelType2).setSubnetMask(ipPrefixTest).build();
    tunnelEndPointsGreNew = new TunnelEndPointsBuilder().setVLANID(vlanId).setPortname(portName2).setIpAddress(ipAddress2).setGwIpAddress(gtwyIp2).setInterfaceName(parentInterfaceName).setTzMembership(ItmUtils.createTransportZoneMembership(transportZone1)).setTunnelType(tunnelType2).setSubnetMask(ipPrefixTest).build();
    tunnelEndPointsListVxlan.add(tunnelEndPointsVxlan);
    tunnelEndPointsListVxlanNew.add(tunnelEndPointsVxlanNew);
    tunnelEndPointsListGre.add(tunnelEndPointsGre);
    tunnelEndPointsListGreNew.add(tunnelEndPointsGreNew);
    dpntePsInfoVxlan = new DPNTEPsInfoBuilder().setDPNID(dpId1).setUp(true).setKey(new DPNTEPsInfoKey(dpId1)).setTunnelEndPoints(tunnelEndPointsListVxlan).build();
    dpntePsInfoVxlanNew = new DPNTEPsInfoBuilder().setDPNID(dpId2).setKey(new DPNTEPsInfoKey(dpId2)).setUp(true).setTunnelEndPoints(tunnelEndPointsListVxlanNew).build();
    dpntePsInfoGre = new DPNTEPsInfoBuilder().setDPNID(dpId1).setUp(true).setKey(new DPNTEPsInfoKey(dpId1)).setTunnelEndPoints(tunnelEndPointsListGre).build();
    dpntePsInfoGreNew = new DPNTEPsInfoBuilder().setDPNID(dpId2).setKey(new DPNTEPsInfoKey(dpId2)).setUp(true).setTunnelEndPoints(tunnelEndPointsListGreNew).build();
    tunnelMonitorParams = new TunnelMonitorParamsBuilder().setEnabled(true).setMonitorProtocol(monitorProtocol).build();
    tunnelMonitorInterval = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
    cfgdDpnListVxlan.add(dpntePsInfoVxlan);
    meshDpnListVxlan.add(dpntePsInfoVxlanNew);
    cfgdDpnListGre.add(dpntePsInfoGre);
    meshDpnListGre.add(dpntePsInfoGreNew);
    dpnEndpointsVxlan = new DpnEndpointsBuilder().setDPNTEPsInfo(cfgdDpnListVxlan).build();
    dpnEndpointsGre = new DpnEndpointsBuilder().setDPNTEPsInfo(cfgdDpnListGre).build();
    doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
    doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
    doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
}
Also used : TunnelEndPointsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder) DPNTEPsInfoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder) DPNTEPsInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey) TunnelMonitorParamsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder) DpnEndpointsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpointsBuilder) TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder)

Aggregations

TunnelMonitorIntervalBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder)7 TunnelMonitorParamsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder)4 ItmMonitorIntervalWorker (org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker)3 TunnelMonitorInterval (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval)3 DpnEndpointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpointsBuilder)3 DPNTEPsInfoBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder)3 DPNTEPsInfoKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey)3 TunnelEndPointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder)3 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)3 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)3 TransportZoneBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder)2 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)2 SubnetsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder)2 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)2 DeviceVtepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder)2 DeviceVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey)2 VtepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsBuilder)2 VtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsKey)2 PrintStream (java.io.PrintStream)1 Test (org.junit.Test)1