Arista Driver add log & Modification of some information
Change-Id: I37657bb906ae555ddfb59dd461bb8d659bba8f61
diff --git a/drivers/arista/src/main/java/org/onosproject/drivers/arista/ControllerConfigAristaImpl.java b/drivers/arista/src/main/java/org/onosproject/drivers/arista/ControllerConfigAristaImpl.java
index 643d87e..0e9f0f2 100644
--- a/drivers/arista/src/main/java/org/onosproject/drivers/arista/ControllerConfigAristaImpl.java
+++ b/drivers/arista/src/main/java/org/onosproject/drivers/arista/ControllerConfigAristaImpl.java
@@ -45,6 +45,7 @@
private static final String SHUTDOWN_CMD = "shutdown";
private static final String REMOVE_CONTROLLER_CMD = "no controller tcp:%s:%d";
private static final String COPY_RUNNING_CONFIG = "copy running-config startup-config";
+ private static final String CONTROLLER_INFO = "controllersInfo";
private static final String CONTROLLER_ADDR = "controllerAddr";
private static final String CONTROLLER_IP = "ip";
private static final String CONTROLLER_PORT = "port";
@@ -62,10 +63,11 @@
List<ControllerInfo> controllers = new ArrayList<>();
Optional<JsonNode> res = AristaUtils.retrieveCommandResult(handler(), SHOW_CONTROLLER_CMD);
if (res == null) {
+ log.warn("There is no connected controller.");
return controllers;
}
- JsonNode controllerInfo = res.get().findValue("controllersInfo");
+ JsonNode controllerInfo = res.get().findValue(CONTROLLER_INFO);
Iterator<JsonNode> controlleriter = controllerInfo.iterator();
while (controlleriter.hasNext()) {
JsonNode temp1 = controlleriter.next();
@@ -94,9 +96,9 @@
//The Arista switch supports up to 8 multi-controllers.
controllers.stream().limit(MAX_CONTROLLERS).forEach(c -> cmds
.add(String.format(SET_CONTROLLER_CMD, c.ip().toString(), c.port())));
- if (controllers.size() > 8) {
+ if (controllers.size() > MAX_CONTROLLERS) {
log.warn(" {} Arista Switch maximun 8 controllers, not adding {} excessive ones",
- handler().data().deviceId(), controllers.size() - 8);
+ handler().data().deviceId(), controllers.size() - MAX_CONTROLLERS);
}
cmds.add(NO_SHUTDOWN_CMD);
cmds.add(COPY_RUNNING_CONFIG);
diff --git a/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java b/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java
index be2d6a0..bdc0e91 100644
--- a/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java
+++ b/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java
@@ -105,18 +105,20 @@
@Override
public List<PortDescription> discoverPortDetails() {
+
Map<String, MacAddress> macAddressMap = getMacAddressesByInterface();
List<PortDescription> ports = Lists.newArrayList();
+ DeviceId deviceId = checkNotNull(handler().data().deviceId());
try {
Optional<JsonNode> result = AristaUtils.retrieveCommandResult(handler(), SHOW_INTERFACES_STATUS);
if (!result.isPresent()) {
+ log.warn("{} Device unable to get interfaces status information.", deviceId);
return ports;
}
JsonNode jsonNode = result.get().findValue(INTERFACE_STATUSES);
-
jsonNode.fieldNames().forEachRemaining(name -> {
JsonNode interfaceNode = jsonNode.get(name);
@@ -170,12 +172,15 @@
}
private Map<String, MacAddress> getMacAddressesByInterface() {
+
+ DeviceId deviceId = checkNotNull(handler().data().deviceId());
Map<String, MacAddress> macAddressMap = new HashMap();
try {
Optional<JsonNode> result = AristaUtils.retrieveCommandResult(handler(), SHOW_INTERFACES);
if (!result.isPresent()) {
+ log.warn("{} Device unable to get interface information.", deviceId);
return macAddressMap;
}
diff --git a/drivers/arista/src/main/resources/arista-drivers.xml b/drivers/arista/src/main/resources/arista-drivers.xml
index 91238a9..9760dbc 100644
--- a/drivers/arista/src/main/resources/arista-drivers.xml
+++ b/drivers/arista/src/main/resources/arista-drivers.xml
@@ -15,7 +15,7 @@
~ limitations under the License.
-->
<drivers>
- <driver name="restArista" manufacturer="Arista Networks" hwVersion="1.0.0" swVersion="1.0.0">
+ <driver name="restArista" manufacturer="Arista Networks" hwVersion="DCS.*" swVersion="">
<behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
impl="org.onosproject.drivers.arista.DeviceDescriptionDiscoveryAristaImpl"/>
<behaviour api="org.onosproject.net.behaviour.ControllerConfig"