Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Leung
551db33074 Merged in NETEXP-3230 (pull request #21)
[NETEXP-3230] fix for not populating Node_Config table

Approved-by: Ralph.lee
2021-10-20 12:52:30 -04:00
11 changed files with 22 additions and 256 deletions

View File

@@ -1152,8 +1152,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
continue;
}
LOG.debug("Values from Vif State Mac (BSSID) {} SSID {} AssociatedClients {} Channel {}", bssid, ssid,
vifState.getAssociatedClients(), channel);
LOG.debug("Values from Vif State Mac (BSSID) {} SSID {} AssociatedClients {} Channel {}", bssid, ssid, vifState.getAssociatedClients());
RadioType radioType = null;
Map<RadioType, RfElementConfiguration> rfElementMap = rfConfig.getRfConfigMap();
@@ -1405,7 +1404,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
apElementConfiguration.getRadioMap().get(radioState.getFreqBand()).setAllowedChannelsPowerLevels(channelPowerLevels);
}
LOG.debug("Updated AllowedChannels from Wifi_Radio_State table change for AP {} configStateMismatch {}", apId, configStateMismatch);
LOG.debug("Updated AllowedChannels from Wifi_Radio_State table change for AP {}", apId);
return configStateMismatch;
}

View File

@@ -1,6 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
@@ -72,33 +70,6 @@
</dependency>
<!-- MQTT dependencies END -->
<!-- Test Dependencies BEGIN -->
<dependency>
<artifactId>status-service-local</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>status-service</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>status-datastore-inmemory</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>cloud-event-dispatcher-empty</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<!-- Test Dependencies END -->
</dependencies>
</project>

View File

@@ -239,19 +239,18 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
String apId = alterClientCnIfRequired(clientCn, connectNodeInfo);
LOG.debug("Client {} connect for AP {}", clientCn, apId);
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
ovsdbDao.removeAllPasspointConfigs(ovsdbClient);
ovsdbDao.removeAllSsids(ovsdbClient); // always
ovsdbDao.removeAllInetConfigs(ovsdbClient);
ovsdbDao.resetWiredPorts(ovsdbClient, opensyncAPConfig);
ovsdbDao.removeWifiRrm(ovsdbClient);
ovsdbDao.removeRadsecRadiusAndRealmConfigs(ovsdbClient);
ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always
extIntegrationInterface.clearEquipmentStatus(apId);
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
if (opensyncAPConfig != null) {
ovsdbDao.configureNode(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiRrm(ovsdbClient, opensyncAPConfig);
@@ -330,7 +329,6 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
ovsdbDao.removeAllPasspointConfigs(ovsdbClient);
ovsdbDao.removeAllSsids(ovsdbClient); // always
ovsdbDao.removeAllInetConfigs(ovsdbClient);
ovsdbDao.resetWiredPorts(ovsdbClient, opensyncAPConfig); // need to run this first before remove Status
ovsdbDao.removeWifiRrm(ovsdbClient);
ovsdbDao.removeRadsecRadiusAndRealmConfigs(ovsdbClient);
ovsdbDao.removeAllStatsConfigs(ovsdbClient);

View File

@@ -210,10 +210,6 @@ public class OvsdbDao extends OvsdbDaoBase {
public void removeAllInetConfigs(OvsdbClient ovsdbClient) {
ovsdbNetwork.removeAllInetConfigs(ovsdbClient);
}
public void resetWiredPorts(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
ovsdbNetwork.resetWiredPorts(ovsdbClient, opensyncApConfig);
}
public void removeAllPasspointConfigs(OvsdbClient ovsdbClient) {
ovsdbHotspot.removeAllPasspointConfigs(ovsdbClient);

View File

@@ -40,26 +40,11 @@ public class OvsdbGet extends OvsdbDaoBase {
Map<String, Set<Integer>> getAllowedChannels(OvsdbClient ovsdbClient) {
Map<String, Set<Integer>> allowedChannels = new HashMap<>();
for (Row row : getOvsdbTableRowsForCondition(ovsdbClient, wifiRadioStateDbTable, null)) {
Set<Integer> channels = new HashSet<>();
if (row.getMapColumn("channels").containsKey("allowed")) {
for (String c : row.getMapColumn("channels").get("allowed").toString().split(",")) {
if (c != null)
channels.add(Integer.valueOf(c));
} ;
}
if (row.getMapColumn("channels").containsKey("radar_detection")) {
for (String c : row.getMapColumn("channels").get("radar_detection").toString().split(",")) {
if (c != null)
channels.add(Integer.valueOf(c));
} ;
}
allowedChannels.put(getSingleValueFromSet(row, "freq_band"), channels);
allowedChannels.put(getSingleValueFromSet(row, "freq_band"), row.getSetColumn("allowed_channels"));
}
return allowedChannels;
}
/**
* Get all Rows from given table that satisfy the conditions.
*

View File

@@ -27,11 +27,6 @@ import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
import com.telecominfraproject.wlan.profile.network.models.GreTunnelConfiguration;
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
import com.telecominfraproject.wlan.status.StatusServiceInterface;
import com.telecominfraproject.wlan.status.equipment.report.models.WiredEthernetPortStatusData;
import com.telecominfraproject.wlan.status.equipment.report.models.WiredPortStatus;
import com.telecominfraproject.wlan.status.models.Status;
import com.telecominfraproject.wlan.status.models.StatusDataType;
import com.vmware.ovsdb.exception.OvsdbClientException;
import com.vmware.ovsdb.protocol.operation.Delete;
import com.vmware.ovsdb.protocol.operation.Insert;
@@ -53,8 +48,6 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
@Autowired
private OvsdbGet ovsdbGet;
@Autowired
private StatusServiceInterface statusServiceInterface;
private static final String VLAN_IF_TYPE = "vlan";
private static final String VLAN_TRUNK_IF_TYPE = "vlan_trunk";
@@ -179,9 +172,6 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
}
private void handleEthernetPortConfiguration(OvsdbClient ovsdbClient, Set<WiredPort> desiredWiredPorts) {
// lists are for more than one lan port moving to wan ("eth0 eth1 eth2")
Set<String> availableLanEthNames = new HashSet<>();
Set<String> availableWanEthNames = new HashSet<>();
if (desiredWiredPorts == null) {
LOG.info("Cannot handle the EthernetPort config for null desired Wired Ports. Exiting");
return;
@@ -192,35 +182,22 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
LOG.error("Cannot find the default wan port from the desired list of ports {}" , desiredWiredPorts);
return;
}
for (WiredPort port: desiredWiredPorts) {
if (port.getIfName().contains(LAN_IF_NAME)) { // for AP has ifName lan1, lan2 instead of lan
availableLanEthNames.add(port.getName());
} else if (WAN_IF_NAME.equals(port.getIfName())) {
availableWanEthNames.add(port.getName());
}
}
for (WiredPort desiredPort : desiredWiredPorts) {
if (!desiredPort.equals(wanPort)) {
if (isLanToBridgeConversion(desiredPort) && !desiredPort.isTrunkEnabled()) {
// Flow 1: Desired Bridge + Access
LOG.debug("Desired Config is Bridge with Access Mode");
availableLanEthNames.remove(desiredPort.getName());
availableWanEthNames.add(desiredPort.getName());
changeLanToWan(ovsdbClient, availableLanEthNames, availableWanEthNames, wanPort.getName());
changeLanToWan(ovsdbClient, desiredPort, wanPort);
createVlanTag(ovsdbClient, desiredPort);
} else if (isLanToBridgeConversion(desiredPort) && desiredPort.isTrunkEnabled()) {
// Flow 2: Desired Bridge + Trunk
LOG.debug("Desired Config is Bridge with Trunk Mode");
availableLanEthNames.remove(desiredPort.getName());
availableWanEthNames.add(desiredPort.getName());
changeLanToWan(ovsdbClient, availableLanEthNames, availableWanEthNames, wanPort.getName());
changeLanToWan(ovsdbClient, desiredPort, wanPort);
createTrunkInterface(ovsdbClient, desiredPort);
} else if (!BRIDGE_IF_TYPE.equalsIgnoreCase(desiredPort.getIfType())) {
// Flow 3: Desired ifType is NAT
LOG.debug("Desired Config is NAT (LAN) mode. Desired Port {} may still be tagged to WAN interface. Convert to LAN mode", desiredPort.getIfName());
availableLanEthNames.add(desiredPort.getName());
availableWanEthNames.remove(desiredPort.getName());
changeWanToLan(ovsdbClient, availableLanEthNames, availableWanEthNames, wanPort.getName());
changeWanToLan(ovsdbClient, desiredPort, wanPort);
} else {
LOG.info("Not a supported Config change requested for the port {}", desiredPort);
}
@@ -251,23 +228,17 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
return wanWiredPort;
}
void changeLanToWan(OvsdbClient ovsdbClient, Set<String> lanPortsToUpdate, Set<String> wanPortsToUpdate, String wanEthName) {
LOG.debug("Calling changeLanToWan: moving port {} to LAN and {} to WAN", lanPortsToUpdate, wanPortsToUpdate);
void changeLanToWan(OvsdbClient ovsdbClient, WiredPort desiredWiredPort, WiredPort wanPort) {
LOG.debug("Moving Port {} with current ifName {} to WAN", desiredWiredPort.getName(), desiredWiredPort.getIfName());
List<Operation> operations = new ArrayList<>();
// Step1: remove lan from eth_ports
// /usr/opensync/bin/ovsh u Wifi_Inet_Config eth_ports:=" " -w if_name==lan
// or cases like: /usr/opensync/bin/ovsh u Wifi_Inet_Config eth_ports:="eth2" -w if_name==lan
String lanPortsString = String.join(SEPARATOR, lanPortsToUpdate);
addEthPortsOperation(operations, lanPortsString.equals("")? SEPARATOR : lanPortsString, LAN_IF_NAME);
addEthPortsOperation(operations, SEPARATOR, LAN_IF_NAME);
// Step2: make lan to a wan port
// /usr/opensync/bin/ovsh u Wifi_Inet_Config eth_ports:="eth0 eth1" -w if_name==wan
// eth_ports syntax is set by AP (i.e, eth0 eth1)
// AP needs the original wan port be the first port in the string. Since we will hard code it, we remove
// original wan name from the set to avoid duplication
wanPortsToUpdate.remove(wanEthName);
// trim() is used when wanPortsToUpdate is empty (i.e. we want "eth0" instead of "eth0 ")
addEthPortsOperation(operations, (wanEthName + SEPARATOR + String.join(SEPARATOR, wanPortsToUpdate)).trim(), WAN_IF_NAME);
addEthPortsOperation(operations, desiredWiredPort.getName() + SEPARATOR + wanPort.getName(), WAN_IF_NAME);
sendOperationsToAP(ovsdbClient, operations, "changeLanToWan");
}
@@ -344,19 +315,15 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
return desiredWiredPort.getAllowedVlanIds().stream().map(String::valueOf).collect(Collectors.joining(SEPARATOR));
}
void changeWanToLan(OvsdbClient ovsdbClient, Set<String> lanPortsToUpdate, Set<String> wanPortsToUpdate, String wanEthName) {
LOG.debug("Calling changeWanToLan: Moving port {} to LAN and {} to WAN", lanPortsToUpdate, wanPortsToUpdate);
void changeWanToLan(OvsdbClient ovsdbClient, WiredPort desiredWiredPort, WiredPort wanPort) {
// Step1: set the correct port to lan
// /usr/opensync/bin/ovsh u Wifi_Inet_Config eth_ports:="eth0" -w if_name==lan
List<Operation> operations = new ArrayList<>();
addEthPortsOperation(operations, String.join(SEPARATOR, lanPortsToUpdate), LAN_IF_NAME);
addEthPortsOperation(operations, desiredWiredPort.getName(), LAN_IF_NAME);
// Step2: set the correct port to wan
// /usr/opensync/bin/ovsh u Wifi_Inet_Config eth_ports:="eth1" -w if_name==wan
// AP needs the original wan port be the first port in the string. Since we will hard code it, we remove
// original wan name from the set to avoid duplication
wanPortsToUpdate.remove(wanEthName);
addEthPortsOperation(operations, (wanEthName + SEPARATOR + String.join(SEPARATOR, wanPortsToUpdate)).trim(), WAN_IF_NAME);
addEthPortsOperation(operations, wanPort.getName(), WAN_IF_NAME);
sendOperationsToAP(ovsdbClient, operations, "changeWanToLan");
}
@@ -576,56 +543,4 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
throw new RuntimeException(e);
}
}
// Reset all LAN ports from WAN back to LAN (NAT mode)
void resetWiredPorts(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
LOG.debug("Calling resetWiredPorts");
// e.g. eth1
Map<String, List<WiredPortStatus>> interfacePortStatusMap = getInterfacePortStatus(
opensyncApConfig.getCustomerEquipment().getCustomerId(),
opensyncApConfig.getCustomerEquipment().getId());
if (interfacePortStatusMap == null) {
LOG.info("No InterfacePort(EthernetPort) Status. Exiting");
return;
}
List<WiredPortStatus> wanPortStatusList = interfacePortStatusMap.get(WAN_IF_NAME);
if (wanPortStatusList == null) {
LOG.info("No wan interface status available. Exiting");
return;
}
WiredPortStatus originalWanPortStatus = wanPortStatusList.stream()
.filter(wan -> WAN_IF_NAME.equals(wan.getOriginalIfName())).findFirst().orElse(null);
if (originalWanPortStatus == null) {
LOG.info("No original wan port available. Exiting");
return;
}
String wanEthName = originalWanPortStatus.getName();
Set<String> lanEthNames = new HashSet<>();
for (WiredPortStatus wanPortStatus : wanPortStatusList) {
if (wanPortStatus.getOriginalIfName().contains(LAN_IF_NAME)) {
lanEthNames.add(wanPortStatus.getName());
}
}
if (!lanEthNames.isEmpty()) {
Set<String> wanEthNameSet = new HashSet<String>();
wanEthNameSet.add(wanEthName);
changeWanToLan(ovsdbClient, lanEthNames, wanEthNameSet, wanEthName);
}
}
private Map<String, List<WiredPortStatus>> getInterfacePortStatus(int customerId, long equipmentId) {
Map<String, List<WiredPortStatus>> interfacePortStatus = null;
// Getting the status from the current AP
Status existingPortStatus = statusServiceInterface.getOrNull(customerId, equipmentId,
StatusDataType.WIRED_ETHERNET_PORT);
if (existingPortStatus != null && existingPortStatus.getDetails() instanceof WiredEthernetPortStatusData) {
interfacePortStatus = ((WiredEthernetPortStatusData) existingPortStatus.getDetails())
.getInterfacePortStatusMap();
}
if (interfacePortStatus == null || interfacePortStatus.isEmpty()) {
LOG.info("No ethernetPortStatus found for customer {}, equipment {}", customerId, equipmentId);
}
return interfacePortStatus;
}
}

View File

@@ -13,6 +13,7 @@ import java.util.concurrent.TimeoutException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.telecominfraproject.wlan.core.model.equipment.LedStatus;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
import com.vmware.ovsdb.exception.OvsdbClientException;

View File

@@ -34,7 +34,6 @@ import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherEmpty;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.location.models.Location;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
@@ -44,9 +43,6 @@ import com.telecominfraproject.wlan.profile.models.ProfileType;
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
import com.telecominfraproject.wlan.profile.network.models.GreTunnelConfiguration;
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
import com.telecominfraproject.wlan.status.StatusServiceLocal;
import com.telecominfraproject.wlan.status.controller.StatusController;
import com.telecominfraproject.wlan.status.datastore.inmemory.StatusDatastoreInMemory;
import com.vmware.ovsdb.exception.OvsdbClientException;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
@@ -67,8 +63,8 @@ import com.vmware.ovsdb.service.OvsdbClient;
@Import(
value = {OvsdbDao.class, OvsdbDaoTest.Config.class, OvsdbNode.class, OvsdbRadioConfig.class, OvsdbHotspotConfig.class, OvsdbCommandConfig.class,
OvsdbMonitor.class, OvsdbFirmwareConfig.class, OvsdbStatsConfig.class, OvsdbSsidConfig.class, OvsdbRrmConfig.class, OvsdbNetworkConfig.class,
OvsdbNodeConfig.class, OvsdbRadiusProxyConfig.class, StatusServiceLocal.class, StatusController.class,
CloudEventDispatcherEmpty.class, StatusDatastoreInMemory.class
OvsdbNodeConfig.class, OvsdbRadiusProxyConfig.class
})
public class OvsdbDaoTest {

View File

@@ -6,11 +6,6 @@ import com.telecominfraproject.wlan.profile.ethernetport.models.WiredEthernetPor
import com.telecominfraproject.wlan.profile.ethernetport.models.WiredPort;
import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.models.ProfileType;
import com.telecominfraproject.wlan.status.StatusServiceInterface;
import com.telecominfraproject.wlan.status.equipment.report.models.WiredEthernetPortStatusData;
import com.telecominfraproject.wlan.status.equipment.report.models.WiredPortStatus;
import com.telecominfraproject.wlan.status.models.Status;
import com.telecominfraproject.wlan.status.models.StatusDataType;
import com.vmware.ovsdb.exception.OvsdbClientException;
import com.vmware.ovsdb.protocol.operation.result.OperationResult;
import com.vmware.ovsdb.protocol.operation.result.UpdateResult;
@@ -32,7 +27,6 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@@ -59,9 +53,6 @@ public class OvsdbNetworkConfigTest {
@Autowired
OvsdbNetworkConfig ovsdbNetworkConfig;
@MockBean(answer = Answers.RETURNS_MOCKS)
StatusServiceInterface statusServiceInterface;
@MockBean(answer = Answers.RETURNS_MOCKS)
OvsdbGet ovsdbGet;
@@ -69,12 +60,10 @@ public class OvsdbNetworkConfigTest {
CompletableFuture<OperationResult[]> futureResult;
private MockitoSession mockito;
private static final String LAN_IF_NAME = "lan";
@Before
public void setUp() throws Exception {
mockito = Mockito.mockitoSession().initMocks(this).strictness(Strictness.WARN).startMocking();
mockito = Mockito.mockitoSession().initMocks(this).strictness(Strictness.STRICT_STUBS).startMocking();
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
}
@@ -123,41 +112,6 @@ public class OvsdbNetworkConfigTest {
Mockito.verify(ovsdbClient, times(1)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
}
// Case when ETH port is in BRIDGE + Trunk and Profile is removed so we convert
// it in NAT (LAN)
@Test
public void testResetWiredPorts_BridgeTrunkToNAT()
throws ExecutionException, InterruptedException, TimeoutException, OvsdbClientException {
// at the beginning LAN's currentIfName is wan
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
Mockito.any(StatusDataType.class))).thenReturn(createWiredEthernetPortStatus("wan"));
OperationResult[] updateResult = new OperationResult[] { new UpdateResult(1) };
Mockito.when(futureResult.get(ovsdbNetworkConfig.ovsdbTimeoutSec, TimeUnit.SECONDS)).thenReturn(updateResult);
ovsdbNetworkConfig.resetWiredPorts(ovsdbClient, createOpensyncApConfig(true, "bridge"));
// transact() execute 1 time as we move LAN from wan interface back to lan
// interface
// (vlan interface will be removed in inetC table directly)
Mockito.verify(ovsdbClient, times(1)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
}
// Case when ETH port is in NAT + Access and Profile is removed we don't do
// anything
@Test
public void testResetWiredPorts_NATToNAT()
throws ExecutionException, InterruptedException, TimeoutException, OvsdbClientException {
// at the beginning LAN's currentIfName is wan
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
Mockito.any(StatusDataType.class))).thenReturn(createWiredEthernetPortStatus("lan"));
OperationResult[] updateResult = new OperationResult[] { new UpdateResult(1) };
Mockito.when(futureResult.get(ovsdbNetworkConfig.ovsdbTimeoutSec, TimeUnit.SECONDS)).thenReturn(updateResult);
ovsdbNetworkConfig.resetWiredPorts(ovsdbClient, createOpensyncApConfig(false, "NAT"));
// Note: Strictness set to WARN in setup() rather than STRICT_STUB as we are
// adding unnecessary stubbings above to test if any transact() is called.
Mockito.verify(ovsdbClient, times(0)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
}
private OpensyncAPConfig createOpensyncApConfig(boolean isTrunkEnabled, String ifType) {
OpensyncAPConfig opensyncApConfig = new OpensyncAPConfig();
@@ -203,43 +157,4 @@ public class OvsdbNetworkConfigTest {
return wiredPort;
}
private Status createWiredEthernetPortStatus(String lanPortIfName) {
WiredEthernetPortStatusData statusDetails = new WiredEthernetPortStatusData();
if (lanPortIfName.equals(LAN_IF_NAME)) {
WiredPortStatus wiredPortStatusLan = createWiredPortStatus(lanPortIfName, "NAT", false, 0, null, "eth0", "lan", "up");
WiredPortStatus wiredPortStatusWan = createWiredPortStatus("wan", "bridge", true, 0, null, "eth1", "wan", "up");
statusDetails.setInterfacePortStatusMap(Map.of("lan", List.of(wiredPortStatusLan), "wan", List.of(wiredPortStatusWan)));
} else {
WiredPortStatus wiredPortStatusLan = createWiredPortStatus(lanPortIfName, "bridge", true, 10, List.of(100,200), "eth0", "lan", "up");
WiredPortStatus wiredPortStatusWan = createWiredPortStatus("wan", "bridge", true, 0, null, "eth1", "wan", "up");
statusDetails.setInterfacePortStatusMap(Map.of("lan", List.of(), "wan", List.of(wiredPortStatusLan, wiredPortStatusWan)));
}
Status status = new Status();
status.setCustomerId(1);
status.setEquipmentId(1L);
status.setStatusDataType(StatusDataType.WIRED_ETHERNET_PORT);
status.setDetails(statusDetails);
return status;
}
private WiredPortStatus createWiredPortStatus(String ifName, String ifType, boolean isTrunkEnabled, int vlanId,
List<Integer> allowedVlans, String name, String originalIfName, String operationalState) {
WiredPortStatus status = new WiredPortStatus();
status.setIfType(ifType);
status.setCurrentIfName(ifName);
status.setOriginalIfName(originalIfName);
status.setName(name);
status.setAllowedVlanIds(allowedVlans);
status.setDuplex("full");
status.setSpeed(1000);
status.setTrunkEnabled(isTrunkEnabled);
status.setOperationalState(operationalState);
status.setVlanId(vlanId);
return status;
}
}

View File

@@ -23,12 +23,8 @@ import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherEmpty;
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
import com.telecominfraproject.wlan.opensync.util.OvsdbToWlanCloudTypeMappingUtility;
import com.telecominfraproject.wlan.status.StatusServiceLocal;
import com.telecominfraproject.wlan.status.controller.StatusController;
import com.telecominfraproject.wlan.status.datastore.inmemory.StatusDatastoreInMemory;
import com.vmware.ovsdb.protocol.operation.result.OperationResult;
import com.vmware.ovsdb.service.OvsdbClient;
@@ -40,8 +36,7 @@ import com.vmware.ovsdb.service.OvsdbClient;
@Import(value = { OvsdbDao.class, OvsdbNodeTest.Config.class, OvsdbNode.class, OvsdbRadioConfig.class,
OvsdbHotspotConfig.class, OvsdbCommandConfig.class, OvsdbMonitor.class, OvsdbFirmwareConfig.class,
OvsdbStatsConfig.class, OvsdbSsidConfig.class, OvsdbRrmConfig.class, OvsdbNetworkConfig.class,
OvsdbNodeConfig.class,OvsdbRadiusProxyConfig.class, StatusServiceLocal.class, StatusController.class,
CloudEventDispatcherEmpty.class, StatusDatastoreInMemory.class
OvsdbNodeConfig.class,OvsdbRadiusProxyConfig.class
})
public class OvsdbNodeTest {

View File

@@ -24,16 +24,12 @@ import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherEmpty;
import com.telecominfraproject.wlan.location.models.Location;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.models.ProfileType;
import com.telecominfraproject.wlan.profile.radius.models.RadiusProfile;
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
import com.telecominfraproject.wlan.status.StatusServiceLocal;
import com.telecominfraproject.wlan.status.controller.StatusController;
import com.telecominfraproject.wlan.status.datastore.inmemory.StatusDatastoreInMemory;
import com.vmware.ovsdb.protocol.operation.result.OperationResult;
import com.vmware.ovsdb.service.OvsdbClient;
@@ -45,8 +41,7 @@ import com.vmware.ovsdb.service.OvsdbClient;
@Import(value = { OvsdbDao.class, OvsdbSsidConfigTest.Config.class, OvsdbNode.class, OvsdbRadioConfig.class,
OvsdbHotspotConfig.class, OvsdbCommandConfig.class, OvsdbMonitor.class, OvsdbFirmwareConfig.class,
OvsdbStatsConfig.class, OvsdbSsidConfig.class, OvsdbRrmConfig.class, OvsdbNetworkConfig.class,
OvsdbNodeConfig.class, OvsdbRadiusProxyConfig.class, StatusServiceLocal.class, StatusController.class,
CloudEventDispatcherEmpty.class, StatusDatastoreInMemory.class
OvsdbNodeConfig.class,OvsdbRadiusProxyConfig.class
})
public class OvsdbSsidConfigTest {