use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams in project genius by opendaylight.
the class TepCommandHelperTest method testConfigureTunnelMonitorParams.
@Test
public void testConfigureTunnelMonitorParams() {
TunnelMonitorParams tunnelMonitor = new TunnelMonitorParamsBuilder().setEnabled(enabled).setMonitorProtocol(monitorProtocol).build();
tepCommandHelper.configureTunnelMonitorParams(enabled, "BFD");
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorParamsIdentifier);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, tunnelMonitorParamsIdentifier, tunnelMonitor, true);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams in project genius by opendaylight.
the class TunnelMonitorChangeListener method remove.
@Override
protected void remove(InstanceIdentifier<TunnelMonitorParams> key, TunnelMonitorParams dataObjectModification) {
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
Class<? extends TunnelMonitoringTypeBase> monitorProtocol = dataObjectModification.getMonitorProtocol();
if (monitorProtocol == null) {
monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
}
if (transportZonesOptional.isPresent()) {
TransportZones transportZones = transportZonesOptional.get();
for (TransportZone tzone : transportZones.getTransportZone()) {
LOG.debug("Remove - TunnelMonitorToggleWorker with tzone = {}, Enable = {}, MonitorProtocol = {}", tzone.getZoneName(), dataObjectModification.isEnabled(), monitorProtocol);
ItmMonitorToggleWorker toggleWorker = new ItmMonitorToggleWorker(tzone.getZoneName(), false, monitorProtocol, broker);
jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams in project genius by opendaylight.
the class TunnelMonitorChangeListener method add.
@Override
protected void add(InstanceIdentifier<TunnelMonitorParams> key, TunnelMonitorParams dataObjectModification) {
LOG.debug("Add - TunnelMonitorToggleWorker with Enable = {}, MonitorProtocol = {}", dataObjectModification.isEnabled(), dataObjectModification.getMonitorProtocol());
Class<? extends TunnelMonitoringTypeBase> monitorProtocol = dataObjectModification.getMonitorProtocol();
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
if (monitorProtocol == null) {
monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
}
if (transportZonesOptional.isPresent()) {
TransportZones tzones = transportZonesOptional.get();
for (TransportZone tzone : tzones.getTransportZone()) {
LOG.debug("Add: TunnelMonitorToggleWorker with tzone = {} monitoringEnabled {} and " + "monitoringProtocol {}", tzone.getZoneName(), dataObjectModification.isEnabled(), dataObjectModification.getMonitorProtocol());
ItmMonitorToggleWorker toggleWorker = new ItmMonitorToggleWorker(tzone.getZoneName(), dataObjectModification.isEnabled(), monitorProtocol, broker);
jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams in project genius by opendaylight.
the class TepCommandHelper method configureTunnelMonitorParams.
public void configureTunnelMonitorParams(boolean monitorEnabled, String monitorProtocol) {
InstanceIdentifier<TunnelMonitorParams> path = InstanceIdentifier.builder(TunnelMonitorParams.class).build();
Optional<TunnelMonitorParams> storedTunnelMonitor = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
Class<? extends TunnelMonitoringTypeBase> monitorType;
if (storedTunnelMonitor.isPresent() && storedTunnelMonitor.get().getMonitorProtocol() != null) {
monitorType = storedTunnelMonitor.get().getMonitorProtocol();
} else {
if (monitorProtocol != null && monitorProtocol.equalsIgnoreCase(ITMConstants.MONITOR_TYPE_LLDP)) {
monitorType = TunnelMonitoringTypeLldp.class;
} else {
monitorType = TunnelMonitoringTypeBfd.class;
}
}
if (!storedTunnelMonitor.isPresent() || storedTunnelMonitor.get().isEnabled() != monitorEnabled) {
TunnelMonitorParams tunnelMonitor = new TunnelMonitorParamsBuilder().setEnabled(monitorEnabled).setMonitorProtocol(monitorType).build();
ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, tunnelMonitor, dataBroker, ItmUtils.DEFAULT_CALLBACK);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams 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