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);
}
}
}
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);
}
}
}
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);
}
}
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);
}
}
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();
}
Aggregations