--- /dev/null
+Cisco Systems, Inc. wishes to acknowledge the seminal and leading work of David Erickson.
+David's implementation of Beacon was one of the first open-source network controllers.
+The OpenDaylight Project would not exist were it not for David's intellectual and
+architectural contribution and his inspiration lives on in the OpenDaylight code base today.
<id>central2</id>\r
<name>central2</name>\r
<url>http://repo2.maven.org/maven2</url>\r
+ <snapshots>\r
+ <enabled>false</enabled>\r
+ </snapshots>\r
+ <releases>\r
+ <enabled>true</enabled>\r
+ </releases>\r
</pluginRepository>\r
<pluginRepository>\r
<id>opendaylight.snapshot</id>\r
<id>central2</id>\r
<name>central2</name>\r
<url>http://repo2.maven.org/maven2</url>\r
+ <snapshots>\r
+ <enabled>false</enabled>\r
+ </snapshots>\r
+ <releases>\r
+ <enabled>true</enabled>\r
+ </releases>\r
</repository>\r
<repository>\r
<id>central</id>\r
<name>central</name>\r
<url>http://repo1.maven.org/maven2</url>\r
+ <snapshots>\r
+ <enabled>false</enabled>\r
+ </snapshots>\r
+ <releases>\r
+ <enabled>true</enabled>\r
+ </releases>\r
</repository>\r
<!-- Pax mirror -->\r
<!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->\r
*/
package org.opendaylight.controller.clustering.services;
-import java.lang.Exception;
-
/**
* Describe an exception that is raised when the cache being
* allocated has configuration errors, like mismatch parameters are
*/
package org.opendaylight.controller.clustering.services;
-import java.lang.Exception;
/**
* Describe an exception that is raised when the cache being
*/
package org.opendaylight.controller.clustering.services;
-import java.lang.Exception;
-
/**
* Describe an exception that is raised when the cache
* Listener being added fails for any reason
*/
package org.opendaylight.controller.clustering.services;
-import java.lang.Exception;
-
/**
* @deprecated for internal use
* The Class ListenRoleChangeAddException.
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
- <type>jar</type>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<id>central2</id>
<name>central2</name>
<url>http://repo2.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</repository>
<repository>
<id>central</id>
<name>central</name>
<url>http://repo1.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</repository>
<!-- Pax mirror -->
<!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->
<artifactId>jackson-jaxrs</artifactId>
<version>${jackson.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
ci.println(this.getNodes(address).toString());
}
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("An error occured",e);
}
}
} catch (CacheConfigException cce) {
log.error("\nCache configuration invalid - check cache mode");
} catch (Exception e) {
- e.printStackTrace();
+ log.error("An error occured",e);
}
}
}
# of.discoveryTimeoutMultiple=2
# For newly added ports, allow one more retry if the elapsed time exceeds this threshold (default 30 sec)
# of.discoveryThreshold=30
-# The maximum number of ports handled in one discovery batch (default 1024)
-# of.discoveryBatchMaxPorts=1024
+# The maximum number of ports handled in one discovery batch (default 512)
+# of.discoveryBatchMaxPorts=512
# TLS configuration
# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files.
}
Matcher sstr;
- if (actions != null && !actions.isEmpty()) {
- for (String actiongrp : actions) {
- // check output ports
- sstr = Pattern.compile("OUTPUT=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- for (String t : sstr.group(1).split(",")) {
- Matcher n = Pattern.compile("(?:(\\d+))").matcher(t);
- if (n.matches()) {
- if (n.group(1) != null) {
- Short port = Short.parseShort(n.group(1));
- if (isPortValid(sw, port) == false) {
- String msg = String.format("Output port %d is not valid for this switch", port);
- if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
- msg += " in Container " + containerName;
- }
- return new Status(StatusCode.BADREQUEST, msg);
+ if (actions == null || actions.isEmpty()) {
+ return new Status(StatusCode.BADREQUEST, "Actions value is null or empty");
+ }
+ for (String actiongrp : actions) {
+ // check output ports
+ sstr = Pattern.compile("OUTPUT=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ for (String t : sstr.group(1).split(",")) {
+ Matcher n = Pattern.compile("(?:(\\d+))").matcher(t);
+ if (n.matches()) {
+ if (n.group(1) != null) {
+ Short port = Short.parseShort(n.group(1));
+ if (isPortValid(sw, port) == false) {
+ String msg = String.format("Output port %d is not valid for this switch", port);
+ if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
+ msg += " in Container " + containerName;
}
+ return new Status(StatusCode.BADREQUEST, msg);
}
}
}
- continue;
}
- // Check src IP
- sstr = Pattern.compile(ActionType.FLOOD.toString()).matcher(actiongrp);
- if (sstr.matches()) {
- if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "flood is not allowed in container %s", containerName));
- }
- continue;
+ continue;
+ }
+ // Check src IP
+ sstr = Pattern.compile(ActionType.FLOOD.toString()).matcher(actiongrp);
+ if (sstr.matches()) {
+ if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "flood is not allowed in container %s", containerName));
}
- // Check src IP
- sstr = Pattern.compile(ActionType.SET_NW_SRC.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format("IP source address %s is not valid",
- sstr.group(1)));
- }
- continue;
+ continue;
+ }
+ // Check src IP
+ sstr = Pattern.compile(ActionType.SET_NW_SRC.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format("IP source address %s is not valid",
+ sstr.group(1)));
}
- // Check dst IP
- sstr = Pattern.compile(ActionType.SET_NW_DST.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "IP destination address %s is not valid", sstr.group(1)));
- }
- continue;
+ continue;
+ }
+ // Check dst IP
+ sstr = Pattern.compile(ActionType.SET_NW_DST.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "IP destination address %s is not valid", sstr.group(1)));
}
+ continue;
+ }
- sstr = Pattern.compile(ActionType.SET_VLAN_ID.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isVlanIdValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "Vlan ID %s is not in the range 0 - 4095", sstr.group(1)));
- }
- continue;
+ sstr = Pattern.compile(ActionType.SET_VLAN_ID.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isVlanIdValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "Vlan ID %s is not in the range 0 - 4095", sstr.group(1)));
}
+ continue;
+ }
- sstr = Pattern.compile(ActionType.SET_VLAN_PCP.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isVlanPriorityValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "Vlan priority %s is not in the range 0 - 7", sstr.group(1)));
- }
- continue;
+ sstr = Pattern.compile(ActionType.SET_VLAN_PCP.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isVlanPriorityValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "Vlan priority %s is not in the range 0 - 7", sstr.group(1)));
}
+ continue;
+ }
- sstr = Pattern.compile(ActionType.SET_DL_SRC.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "Ethernet source address %s is not valid. Example: 00:05:b9:7c:81:5f",
- sstr.group(1)));
- }
- continue;
+ sstr = Pattern.compile(ActionType.SET_DL_SRC.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "Ethernet source address %s is not valid. Example: 00:05:b9:7c:81:5f",
+ sstr.group(1)));
}
- sstr = Pattern.compile(ActionType.SET_DL_DST.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "Ethernet destination address %s is not valid. Example: 00:05:b9:7c:81:5f",
- sstr.group(1)));
- }
- continue;
+ continue;
+ }
+ sstr = Pattern.compile(ActionType.SET_DL_DST.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "Ethernet destination address %s is not valid. Example: 00:05:b9:7c:81:5f",
+ sstr.group(1)));
}
+ continue;
+ }
- sstr = Pattern.compile(ActionType.SET_NW_TOS.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isTOSBitsValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "IP ToS bits %s is not in the range 0 - 63", sstr.group(1)));
- }
- continue;
+ sstr = Pattern.compile(ActionType.SET_NW_TOS.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isTOSBitsValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "IP ToS bits %s is not in the range 0 - 63", sstr.group(1)));
}
+ continue;
+ }
- sstr = Pattern.compile(ActionType.SET_TP_SRC.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "Transport source port %s is not valid", sstr.group(1)));
- }
- continue;
+ sstr = Pattern.compile(ActionType.SET_TP_SRC.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "Transport source port %s is not valid", sstr.group(1)));
}
+ continue;
+ }
- sstr = Pattern.compile(ActionType.SET_TP_DST.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "Transport destination port %s is not valid", sstr.group(1)));
- }
- continue;
+ sstr = Pattern.compile(ActionType.SET_TP_DST.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "Transport destination port %s is not valid", sstr.group(1)));
}
- sstr = Pattern.compile(ActionType.SET_NEXT_HOP.toString() + "=(.*)").matcher(actiongrp);
- if (sstr.matches()) {
- if (!NetUtils.isIPAddressValid(sstr.group(1))) {
- return new Status(StatusCode.BADREQUEST, String.format(
- "IP destination address %s is not valid", sstr.group(1)));
- }
- continue;
+ continue;
+ }
+ sstr = Pattern.compile(ActionType.SET_NEXT_HOP.toString() + "=(.*)").matcher(actiongrp);
+ if (sstr.matches()) {
+ if (!NetUtils.isIPAddressValid(sstr.group(1))) {
+ return new Status(StatusCode.BADREQUEST, String.format(
+ "IP destination address %s is not valid", sstr.group(1)));
}
+ continue;
}
}
// Check against the container flow
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
-import org.opendaylight.controller.forwardingrulesmanager.FlowEntry;
import org.opendaylight.controller.sal.action.Action;
import org.opendaylight.controller.sal.action.ActionType;
import org.opendaylight.controller.sal.action.Controller;
Assert.assertTrue(status.getDescription().contains("Node is null"));
fc.setNode(Node.fromString(Node.NodeIDType.OPENFLOW, "1"));
+ Assert.assertFalse(fc.validate(null).isSuccess());
+ List<String> actions = new ArrayList<String>();
+ fc.setActions(actions);
+ Assert.assertFalse(fc.validate(null).isSuccess());
+ actions.add("OUTPUT=2");
+ fc.setActions(actions);
Assert.assertTrue(fc.validate(null).isSuccess());
fc.setPriority("-1");
javax.xml.bind.annotation,
javax.xml.bind,
org.slf4j,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Export-Package>
@PathParam(value = "name") String name,
@PathParam("nodeType") String nodeType,
@PathParam(value = "nodeId") String nodeId,
- @TypeHint(FlowConfig.class) JAXBElement<FlowConfig> flowConfig) {
+ @TypeHint(FlowConfig.class) FlowConfig flowConfig) {
if (!NorthboundUtils.isAuthorized(
getUserName(), containerName, Privilege.WRITE, this)) {
"User is not authorized to perform this operation on container "
+ containerName);
}
- handleResourceCongruence(name, flowConfig.getValue().getName());
- handleResourceCongruence(nodeId, flowConfig.getValue().getNode().getNodeIDString());
+
+ if (flowConfig.getNode() == null) {
+ return Response.status(Response.Status.BAD_REQUEST).entity("Invalid Configuration. Node is null or empty")
+ .build();
+ }
+ handleResourceCongruence(name, flowConfig.getName());
+ handleResourceCongruence(nodeId, flowConfig.getNode().getNodeIDString());
handleDefaultDisabled(containerName);
IForwardingRulesManager frm = getForwardingRulesManagerService(containerName);
+ RestMessages.RESOURCECONFLICT.toString());
}
- Status status = frm.addStaticFlow(flowConfig.getValue());
+ Status status = frm.addStaticFlow(flowConfig);
if (status.isSuccess()) {
NorthboundUtils.auditlog("Flow", username, "added", name, containerName);
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(FlowProgrammerNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
javax.xml.bind,
org.slf4j,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Web-ContextPath>/controller/nb/v2/host</Web-ContextPath>
@ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
public Response addHost(@Context UriInfo uriInfo, @PathParam("containerName") String containerName,
@PathParam("networkAddress") String networkAddress,
- @TypeHint(HostConfig.class) JAXBElement<HostConfig> hostConfig) {
+ @TypeHint(HostConfig.class) HostConfig hostConfig) {
if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
return Response.status(Response.Status.UNAUTHORIZED)
IfIptoHost hostTracker = getIfIpToHostService(containerName);
- HostConfig hc = hostConfig.getValue();
+ HostConfig hc = hostConfig;
if (!networkAddress.equals(hc.getNetworkAddress())) {
return Response.status(Response.Status.CONFLICT)
.entity("Resource name in config object doesn't match URI")
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* This class is an instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(HostTrackerNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
<id>central2</id>
<name>central2</name>
<url>http://repo2.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<artifactId>jackson-jaxrs</artifactId>
<version>${jackson.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
}
is.close();
connection.disconnect();
+ if (debugMsg) {
+ System.out.println("Response : "+sb.toString());
+ }
return sb.toString();
} catch (Exception e) {
return null;
Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("id"));
Assert.assertEquals(nodeType, nodeInfo.getString("type"));
- JSONObject properties = node.getJSONObject("properties");
-
- if (timestamp == null || timestampName == null) {
- Assert.assertFalse(properties.has("timeStamp"));
- } else {
- Assert.assertEquals(timestamp, (Integer) properties.getJSONObject("timeStamp").getInt("value"));
- Assert.assertEquals(timestampName, properties.getJSONObject("timeStamp").getString("name"));
- }
- if (actionsValue == null) {
- Assert.assertFalse(properties.has("actions"));
- } else {
- Assert.assertEquals(actionsValue, (Integer) properties.getJSONObject("actions").getInt("value"));
- }
- if (capabilitiesValue == null) {
- Assert.assertFalse(properties.has("capabilities"));
- } else {
- Assert.assertEquals(capabilitiesValue,
- (Integer) properties.getJSONObject("capabilities").getInt("value"));
- }
- if (tablesValue == null) {
- Assert.assertFalse(properties.has("tables"));
- } else {
- Assert.assertEquals(tablesValue, (Integer) properties.getJSONObject("tables").getInt("value"));
- }
- if (buffersValue == null) {
- Assert.assertFalse(properties.has("buffers"));
- } else {
- Assert.assertEquals(buffersValue, (Integer) properties.getJSONObject("buffers").getInt("value"));
+ JSONArray propsArray = node.getJSONArray("properties");
+
+ for (int j = 0; j < propsArray.length(); j++) {
+ JSONObject properties = propsArray.getJSONObject(j);
+ String propName = properties.getString("name");
+ if (propName.equals("timeStamp")) {
+ if (timestamp == null || timestampName == null) {
+ Assert.assertFalse("Timestamp exist", true);
+ } else {
+ Assert.assertEquals(timestamp, (Integer) properties.getInt("value"));
+ Assert.assertEquals(timestampName, properties.getString("timestampName"));
+ }
+ }
+ if (propName.equals("actions")) {
+ if (actionsValue == null) {
+ Assert.assertFalse("Actions exist", true);
+ } else {
+ Assert.assertEquals(actionsValue, (Integer) properties.getInt("value"));
+ }
+ }
+ if (propName.equals("capabilities")) {
+ if (capabilitiesValue == null) {
+ Assert.assertFalse("Capabilities exist", true);
+ } else {
+ Assert.assertEquals(capabilitiesValue, (Integer) properties.getInt("value"));
+ }
+ }
+ if (propName.equals("tables")) {
+ if (tablesValue == null) {
+ Assert.assertFalse("Tables exist", true);
+ } else {
+ Assert.assertEquals(tablesValue, (Integer) properties.getInt("value"));
+ }
+ }
+ if (propName.equals("buffers")) {
+ if (buffersValue == null) {
+ Assert.assertFalse("Buffers exist", true);
+ } else {
+ Assert.assertEquals(buffersValue, (Integer) properties.getInt("value"));
+ }
+ }
}
}
JSONObject nodeConnector = nodeConnectorProperties.getJSONObject("nodeconnector");
JSONObject node = nodeConnector.getJSONObject("node");
- JSONObject properties = nodeConnectorProperties.getJSONObject("properties");
Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("id"));
Assert.assertEquals(ncType, nodeConnector.getString("type"));
Assert.assertEquals(nodeId, (Integer) node.getInt("id"));
Assert.assertEquals(nodeType, node.getString("type"));
- if (state == null) {
- Assert.assertFalse(properties.has("state"));
- } else {
- Assert.assertEquals(state, (Integer) properties.getJSONObject("state").getInt("value"));
- }
- if (capabilities == null) {
- Assert.assertFalse(properties.has("capabilities"));
- } else {
- Assert.assertEquals(capabilities,
- (Integer) properties.getJSONObject("capabilities").getInt("value"));
- }
- if (bandwidth == null) {
- Assert.assertFalse(properties.has("bandwidth"));
- } else {
- Assert.assertEquals(bandwidth, (Integer) properties.getJSONObject("bandwidth").getInt("value"));
- }
+ JSONArray propsArray = nodeConnectorProperties.getJSONArray("properties");
+ for (int j = 0; j < propsArray.length(); j++) {
+ JSONObject properties = propsArray.getJSONObject(j);
+ String propName = properties.getString("name");
+ if (propName.equals("state")) {
+ if (state == null) {
+ Assert.assertFalse("State exist", true);
+ } else {
+ Assert.assertEquals(state, (Integer) properties.getInt("value"));
+ }
+ }
+ if (propName.equals("capabilities")) {
+ if (capabilities == null) {
+ Assert.assertFalse("Capabilities exist", true);
+ } else {
+ Assert.assertEquals(capabilities, (Integer) properties.getInt("value"));
+ }
+ }
+ if (propName.equals("bandwidth")) {
+ if (bandwidth == null) {
+ Assert.assertFalse("bandwidth exist", true);
+ } else {
+ Assert.assertEquals(bandwidth, (Integer) properties.getInt("value"));
+ }
+ }
+ }
}
@Test
String result = getJsonResult(baseURL + "default/subnet/all");
JSONTokener jt = new JSONTokener(result);
JSONObject json = new JSONObject(jt);
- Assert.assertEquals("{}", result);
+ JSONArray subnetConfigs = json.getJSONArray("subnetConfig");
+ Assert.assertEquals(subnetConfigs.length(), 0);
// Test GET subnet1 expecting 404
result = getJsonResult(baseURL + "default/subnet/" + name1);
Assert.assertEquals(404, httpResponseCode.intValue());
// Test POST subnet1
- JSONObject jo = new JSONObject().append("name", name1).append("subnet", subnet1);
+ JSONObject jo = new JSONObject().put("name", name1).put("subnet", subnet1);
// execute HTTP request and verify response code
result = getJsonResult(baseURL + "default/subnet/" + name1, "POST", jo.toString());
Assert.assertTrue(httpResponseCode == 201);
Assert.assertEquals(subnet1, json.getString("subnet"));
// Test POST subnet2
- JSONObject jo2 = new JSONObject().append("name", name2).append("subnet", subnet2);
+ JSONObject jo2 = new JSONObject().put("name", name2).put("subnet", subnet2);
// execute HTTP request and verify response code
result = getJsonResult(baseURL + "default/subnet/" + name2, "POST", jo2.toString());
Assert.assertEquals(201, httpResponseCode.intValue());
result = getJsonResult(baseURL + "default/subnet/" + name2 + "/node-ports", "POST", jo2.toString());
Assert.assertEquals(200, httpResponseCode.intValue());
// Test POST subnet3
- JSONObject jo3 = new JSONObject().append("name", name3).append("subnet", subnet3);
+ JSONObject jo3 = new JSONObject().put("name", name3).put("subnet", subnet3);
// execute HTTP request and verify response code
result = getJsonResult(baseURL + "default/subnet/" + name3, "POST", jo3.toString());
Assert.assertEquals(201, httpResponseCode.intValue());
Assert.assertEquals(subnet1, subnetConfig.getString("subnet"));
} else if (subnetConfig.getString("name").equals(name2)) {
Assert.assertEquals(subnet2, subnetConfig.getString("subnet"));
- String[] nodePortsGet2 = subnetConfig.getString("nodePorts").split(",");
+ String[] nodePortsGet2 = subnetConfig.getJSONArray("nodePorts").getString(0).split(",");
Assert.assertEquals(nodePorts2[0], nodePortsGet2[0]);
Assert.assertEquals(nodePorts2[1], nodePortsGet2[1]);
Assert.assertEquals(nodePorts2[2], nodePortsGet2[2]);
Assert.assertEquals(nodePorts2[3], nodePortsGet2[3]);
} else if (subnetConfig.getString("name").equals(name3)) {
Assert.assertEquals(subnet3, subnetConfig.getString("subnet"));
- String[] nodePortsGet = subnetConfig.getString("nodePorts").split(",");
+ String[] nodePortsGet = subnetConfig.getJSONArray("nodePorts").getString(0).split(",");
Assert.assertEquals(nodePorts3[0], nodePortsGet[0]);
Assert.assertEquals(nodePorts3[1], nodePortsGet[1]);
Assert.assertEquals(nodePorts3[2], nodePortsGet[2]);
String result = getJsonResult(baseURL + "default");
JSONTokener jt = new JSONTokener(result);
JSONObject json = new JSONObject(jt);
- Assert.assertEquals("{}", result);
+ JSONArray staticRoutes = json.getJSONArray("staticRoute");
+ Assert.assertEquals(staticRoutes.length(), 0);
// Test insert static route
String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\"" + prefix1 + "\", \"nextHop\":\"" + nextHop1
result = getJsonResult(baseURL + "default");
jt = new JSONTokener(result);
json = new JSONObject(jt);
- JSONArray staticRoutes = json.getJSONArray("staticRoute");
- Assert.assertEquals(2, staticRoutes.length());
+ JSONArray staticRouteArray = json.getJSONArray("staticRoute");
+ Assert.assertEquals(2, staticRouteArray.length());
JSONObject route;
for (int i = 0; i < staticRoutes.length(); i++) {
route = staticRoutes.getJSONObject(i);
result = getJsonResult(baseURL + "default");
jt = new JSONTokener(result);
json = new JSONObject(jt);
- JSONObject singleStaticRoute = json.getJSONObject("staticRoute");
+
+ staticRouteArray = json.getJSONArray("staticRoute");
+ JSONObject singleStaticRoute = staticRouteArray.getJSONObject(0);
Assert.assertEquals(name2, singleStaticRoute.getString("name"));
}
result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
jt = new JSONTokener(result);
json = new JSONObject(jt);
- JSONObject nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+ JSONArray nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+ JSONObject nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, ncState,
ncCapabilities, ncBandwidth);
result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
jt = new JSONTokener(result);
json = new JSONObject(jt);
- nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+
+ nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+ nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
+
testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
ncCapabilities, ncBandwidth);
jt = new JSONTokener(result);
json = new JSONObject(jt);
- nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+ nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+ nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3, ncType, nodeId_3, nodeType, ncState,
ncCapabilities, ncBandwidth);
json = new JSONObject(jt);
node = getJsonInstance(json, "nodeProperties", nodeId_1);
Assert.assertNotNull(node);
- Assert.assertEquals(1001, node.getJSONObject("properties").getJSONObject("tier").getInt("value"));
- Assert.assertEquals("node1", node.getJSONObject("properties").getJSONObject("description").getString("value"));
+
+ JSONArray propsArray = node.getJSONArray("properties");
+
+ for (int j = 0; j < propsArray.length(); j++) {
+ JSONObject properties = propsArray.getJSONObject(j);
+ String propName = properties.getString("name");
+ if (propName.equals("tier")) {
+ Assert.assertEquals(1001, properties.getInt("value"));
+ }
+ if (propName.equals("description")) {
+ Assert.assertEquals("node1", properties.getString("value"));
+ }
+ }
// Test delete nodeConnector property
// Delete state property of nodeconnector1
result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
jt = new JSONTokener(result);
json = new JSONObject(jt);
- nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+ nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+ nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
ncCapabilities, ncBandwidth);
result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
jt = new JSONTokener(result);
json = new JSONObject(jt);
- nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+ nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+ nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
null, ncBandwidth);
result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
jt = new JSONTokener(result);
json = new JSONObject(jt);
- nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+ nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+ nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
// Check for new bandwidth value, state value removed from previous
// test
@Test
public void testStatistics() throws JSONException {
- final String actionTypes[] = { "drop", "loopback", "flood", "floodAll", "controller", "swPath", "hwPath", "output",
- "setDlSrc", "setDlDst", "setDlType", "setVlanId", "setVlanPcp", "setVlanCfi", "popVlan", "pushVlan",
- "setNwSrc", "setNwDst", "setNwTos", "setTpSrc", "setTpDst" };
+ final String actionTypes[] = { "DROP", "LOOPBACK", "FLOOD", "FLOOD_ALL", "CONTROLLER", "SW_PATH", "HW_PATH", "OUTPUT",
+ "SET_DL_SRC", "SET_DL_DST", "SET_DL_TYPE", "SET_VLAN_ID", "SET_VLAN_PCP", "SET_VLAN_CFI", "POP_VLAN", "PUSH_VLAN",
+ "SET_NW_SRC", "SET_NW_DST", "SET_NW_TOS", "SET_TP_SRC", "SET_TP_DST" };
System.out.println("Starting Statistics JAXB client.");
String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/";
Assert.assertEquals(node2.getString("type"), "STUB");
// test that port statistic results are correct
- JSONObject portStat = portStatistics.getJSONObject("portStatistic");
+ JSONArray portStatArray = portStatistics.getJSONArray("portStatistic");
+ JSONObject portStat = portStatArray.getJSONObject(0);
Assert.assertTrue(portStat.getInt("receivePackets") == 250);
Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
Assert.assertEquals(node2.getString("type"), "STUB");
// test that port statistic results are correct
- portStat = json.getJSONObject("portStatistic");
+ portStatArray = json.getJSONArray("portStatistic");
+ portStat = portStatArray.getJSONObject(0);
+
Assert.assertTrue(portStat.getInt("receivePackets") == 250);
Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
Assert.assertTrue(flow.getInt("id") == 12345);
- JSONObject match = (flow.getJSONObject("match").getJSONObject("matchField"));
+ JSONArray matches = (flow.getJSONObject("match").getJSONArray("matchField"));
+ Assert.assertEquals(matches.length(), 1);
+ JSONObject match = matches.getJSONObject(0);
Assert.assertTrue(match.getString("type").equals("NW_DST"));
Assert.assertTrue(match.getString("value").equals("1.1.1.1"));
- JSONObject act = flow.getJSONObject("actions");
- Assert.assertTrue(act.getString("@type").equals(actionType));
+ JSONArray actionsArray = flow.getJSONArray("actions");
+ Assert.assertEquals(actionsArray.length(), 1);
+ JSONObject act = actionsArray.getJSONObject(0);
+ Assert.assertTrue(act.getString("type").equals(actionType));
- if (act.getString("@type").equals("output")) {
+ if (act.getString("type").equals("OUTPUT")) {
JSONObject port = act.getJSONObject("port");
JSONObject port_node = port.getJSONObject("node");
Assert.assertTrue(port.getInt("id") == 51966);
Assert.assertTrue(port_node.getString("type").equals("STUB"));
}
- if (act.getString("@type").equals("setDlSrc")) {
+ if (act.getString("type").equals("SET_DL_SRC")) {
byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 1 };
String src = act.getString("address");
byte srcBytes[] = new byte[5];
Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
}
- if (act.getString("@type").equals("setDlDst")) {
+ if (act.getString("type").equals("SET_DL_DST")) {
byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
String dst = act.getString("address");
byte dstBytes[] = new byte[5];
dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
}
- if (act.getString("@type").equals("setDlType"))
+ if (act.getString("type").equals("SET_DL_TYPE"))
Assert.assertTrue(act.getInt("dlType") == 10);
- if (act.getString("@type").equals("setVlanId"))
+ if (act.getString("type").equals("SET_VLAN_ID"))
Assert.assertTrue(act.getInt("vlanId") == 2);
- if (act.getString("@type").equals("setVlanPcp"))
+ if (act.getString("type").equals("SET_VLAN_PCP"))
Assert.assertTrue(act.getInt("pcp") == 3);
- if (act.getString("@type").equals("setVlanCfi"))
+ if (act.getString("type").equals("SET_VLAN_CFI"))
Assert.assertTrue(act.getInt("cfi") == 1);
- if (act.getString("@type").equals("setNwSrc"))
+ if (act.getString("type").equals("SET_NW_SRC"))
Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
- if (act.getString("@type").equals("setNwDst"))
+ if (act.getString("type").equals("SET_NW_DST"))
Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
- if (act.getString("@type").equals("pushVlan")) {
+ if (act.getString("type").equals("PUSH_VLAN")) {
int head = act.getInt("VlanHeader");
// parsing vlan header
int id = head & 0xfff;
Assert.assertTrue(pcp == 1);
Assert.assertTrue(tag == 0x8100);
}
- if (act.getString("@type").equals("setNwTos"))
+ if (act.getString("type").equals("SET_NW_TOS"))
Assert.assertTrue(act.getInt("tos") == 16);
- if (act.getString("@type").equals("setTpSrc"))
+ if (act.getString("type").equals("SET_TP_SRC"))
Assert.assertTrue(act.getInt("port") == 4201);
- if (act.getString("@type").equals("setTpDst"))
+ if (act.getString("type").equals("SET_TP_DST"))
Assert.assertTrue(act.getInt("port") == 8080);
}
Assert.assertTrue(result.equals("404"));
// test add flow1
- String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+ String fc = "{\"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc);
Assert.assertTrue(httpResponseCode == 201);
JSONTokener jt = new JSONTokener(result);
JSONObject json = new JSONObject(jt);
Assert.assertEquals(json.getString("name"), "test1");
- Assert.assertEquals(json.getString("actions"), "DROP");
+ JSONArray actionsArray = json.getJSONArray("actions");
+ Assert.assertEquals(actionsArray.getString(0), "DROP");
Assert.assertEquals(json.getString("installInHw"), "true");
JSONObject node = json.getJSONObject("node");
Assert.assertEquals(node.getString("type"), "STUB");
result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc);
Assert.assertTrue(result.equals("409"));
- fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+ fc = "{\"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc);
// test should return 409 for error due to same flow being added.
Assert.assertTrue(result.equals("409"));
// add second flow that's different
- fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+ fc = "{\"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc);
Assert.assertTrue(httpResponseCode == 201);
JSONObject headNC = edge.getJSONObject("headNodeConnector");
JSONObject headNode = headNC.getJSONObject("node");
- JSONObject Props = edgeProp.getJSONObject("properties");
- JSONObject bandw = Props.getJSONObject("bandwidth");
- JSONObject stt = Props.getJSONObject("state");
- JSONObject ltc = Props.getJSONObject("latency");
+
+ JSONArray propsArray = edgeProp.getJSONArray("properties");
+
+ JSONObject bandw = null;
+ JSONObject stt = null;
+ JSONObject ltc = null;
+
+ for (int j = 0; j < propsArray.length(); j++) {
+ JSONObject props = propsArray.getJSONObject(j);
+ String propName = props.getString("name");
+ if (propName.equals("bandwidth")) bandw = props;
+ if (propName.equals("state")) stt = props;
+ if (propName.equals("latency")) ltc = props;
+ }
if (headNC.getInt("id") == headNC1_nodeConnId) {
Assert.assertEquals(headNode.getString("type"), nodeType);
Integer nodeConnectorId_2 = 34;
JSONObject jo = new JSONObject()
- .append("name", "userLink_1")
- .append("srcNodeConnector",
+ .put("name", "userLink_1")
+ .put("srcNodeConnector",
nodeConnectorType_1 + "|" + nodeConnectorId_1 + "@" + nodeType_1 + "|" + nodeId_1)
- .append("dstNodeConnector",
+ .put("dstNodeConnector",
nodeConnectorType_2 + "|" + nodeConnectorId_2 + "@" + nodeType_2 + "|" + nodeId_2);
// execute HTTP request and verify response code
result = getJsonResult(baseURL + "/user-link", "PUT", jo.toString());
mavenBundle("org.codehaus.jackson", "jackson-mapper-asl").versionAsInProject(),
mavenBundle("org.codehaus.jackson", "jackson-core-asl").versionAsInProject(),
mavenBundle("org.codehaus.jackson", "jackson-jaxrs").versionAsInProject(),
+ mavenBundle("org.codehaus.jackson", "jackson-xc").versionAsInProject(),
mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
mavenBundle("commons-io", "commons-io").versionAsInProject(),
javax.xml.bind.annotation,
javax.xml.bind,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Export-Package>
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(BridgeDomainNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
javax.xml.bind.annotation,
javax.xml.bind,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Export-Package>
@Context UriInfo uriInfo,
@PathParam(value = "containerName") String containerName,
@PathParam(value = "route") String route,
- @TypeHint(StaticRoute.class) JAXBElement<StaticRoute> staticRouteData) {
+ @TypeHint(StaticRoute.class) StaticRoute staticRouteData) {
if(!NorthboundUtils.isAuthorized(getUserName(), containerName,
.toString());
}
- StaticRoute sRoute = staticRouteData.getValue();
+ StaticRoute sRoute = staticRouteData;
StaticRouteConfig cfgObject = new StaticRouteConfig(sRoute.getName(),
sRoute.getPrefix(), sRoute.getNextHop());
Status response = staticRouting.addStaticRoute(cfgObject);
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(StaticRoutingNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
javax.xml.bind,
org.slf4j,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Export-Package>
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(StatisticsNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
javax.xml.bind.annotation,
org.slf4j,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Export-Package>
import org.opendaylight.controller.switchmanager.SubnetConfig;
-@XmlRootElement
+@XmlRootElement (name = "list")
@XmlAccessorType(XmlAccessType.NONE)
public class SubnetConfigs {
@ResponseCode(code = 503, condition = "Service unavailable") })
public Response addSubnet(@PathParam("containerName") String containerName,
@PathParam("subnetName") String subnetName,
- @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+ @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
handleContainerDoesNotExist(containerName);
throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ containerName);
}
- SubnetConfig cfgObject = subnetConfigData.getValue();
+ SubnetConfig cfgObject = subnetConfigData;
handleNameMismatch(cfgObject.getName(), subnetName);
ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName, this);
@ResponseCode(code = 503, condition = "Service unavailable") })
public Response modifySubnet(@PathParam("containerName") String containerName,
@PathParam("subnetName") String subnetName,
- @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+ @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
handleContainerDoesNotExist(containerName);
throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ containerName);
}
- handleNameMismatch(subnetConfigData.getValue().getName(), subnetName);
+ handleNameMismatch(subnetConfigData.getName(), subnetName);
ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName,
this);
throw new ServiceUnavailableException("SwitchManager " + RestMessages.SERVICEUNAVAILABLE.toString());
}
- SubnetConfig subnetConf = subnetConfigData.getValue();
+ SubnetConfig subnetConf = subnetConfigData;
SubnetConfig existingConf = switchManager.getSubnetConfig(subnetName);
boolean successful = true;
@ResponseCode(code = 503, condition = "Service unavailable") })
public Response addNodePorts(@PathParam("containerName") String containerName,
@PathParam("subnetName") String subnetName,
- @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+ @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
handleContainerDoesNotExist(containerName);
throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ containerName);
}
- handleNameMismatch(subnetConfigData.getValue().getName(), subnetName);
+ handleNameMismatch(subnetConfigData.getName(), subnetName);
- SubnetConfig subnetConf = subnetConfigData.getValue();
+ SubnetConfig subnetConf = subnetConfigData;
ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName,
this);
@ResponseCode(code = 503, condition = "Service unavailable") })
public Response deleteNodePorts(@PathParam("containerName") String containerName,
@PathParam("subnetName") String subnetName,
- @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+ @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
handleContainerDoesNotExist(containerName);
throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ containerName);
}
- handleNameMismatch(subnetConfigData.getValue().getName(), subnetName);
+ handleNameMismatch(subnetConfigData.getName(), subnetName);
- SubnetConfig subnetConf = subnetConfigData.getValue();
+ SubnetConfig subnetConf = subnetConfigData;
if (subnetConf.getNodePorts() == null || subnetConf.getNodePorts().isEmpty()) {
throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : invalid node ports");
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(SubnetsNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
javax.xml.bind,
org.slf4j,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Web-ContextPath>/controller/nb/v2/switch</Web-ContextPath>
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(SwitchNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
javax.xml.bind.annotation,
org.slf4j,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Web-ContextPath>/controller/nb/v2/topology</Web-ContextPath>
if (topo != null) {
List<EdgeProperties> res = new ArrayList<EdgeProperties>();
for (Map.Entry<Edge, Set<Property>> entry : topo.entrySet()) {
- EdgeProperties el = new EdgeProperties(entry.getKey(),
- entry.getValue());
+ EdgeProperties el = new EdgeProperties(entry.getKey(), entry.getValue());
res.add(el);
}
return new Topology(res);
@ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
public Response addUserLink(
@PathParam(value = "containerName") String containerName,
- @TypeHint(TopologyUserLinkConfig.class) JAXBElement<TopologyUserLinkConfig> userLinkConfig) {
+ @TypeHint(TopologyUserLinkConfig.class) TopologyUserLinkConfig userLinkConfig) {
if (!NorthboundUtils.isAuthorized(
getUserName(), containerName, Privilege.WRITE, this)) {
RestMessages.NOCONTAINER.toString());
}
- Status status = topologyManager.addUserLink(userLinkConfig.getValue());
+ Status status = topologyManager.addUserLink(userLinkConfig);
if (status.isSuccess()) {
- NorthboundUtils.auditlog("User Link", username, "added", userLinkConfig.getValue().getName(), containerName);
+ NorthboundUtils.auditlog("User Link", username, "added", userLinkConfig.getName(), containerName);
return Response.status(Response.Status.CREATED).build();
}
throw new InternalServerErrorException(status.getDescription());
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* Instance of javax.ws.rs.core.Application used to return the classes
* that will be instantiated for JAXRS processing, this is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(TopologyNorthboundJAXRS.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig;
-@XmlRootElement
+@XmlRootElement (name = "list")
@XmlAccessorType(XmlAccessType.NONE)
public class TopologyUserLinks {
class DiscoveryTransmit implements Runnable {
private final BlockingQueue<NodeConnector> transmitQ;
+ private int count = 0;
DiscoveryTransmit(BlockingQueue<NodeConnector> transmitQ) {
this.transmitQ = transmitQ;
RawPacket outPkt = createDiscoveryPacket(nodeConnector);
sendDiscoveryPacket(nodeConnector, outPkt);
nodeConnector = null;
+ if ((++count & 0x7f) == 0) {
+ Thread.sleep(10);
+ }
} catch (InterruptedException e1) {
logger.warn("DiscoveryTransmit interupted", e1.getMessage());
if (shuttingDown) {
*/
private int getDiscoveryBatchMaxPorts() {
String val = System.getProperty("of.discoveryBatchMaxPorts");
- int ports = 1024;
+ int ports = 512;
if (val != null) {
try {
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
private static final Logger logger = LoggerFactory.getLogger(Action.class);
private static boolean debug = false; // Enable to find where in the code an
// invalid assignment is made
- @XmlTransient
+ @XmlElement
protected ActionType type;
private transient boolean isValid = true;
*/
package org.opendaylight.controller.sal.core;
-import java.lang.Exception;
-
public class ConstructionException extends Exception {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@XmlElement(name = "value")
private long timestamp;
- @XmlElement(name = "name")
+ @XmlElement(name = "timestampName")
private String timestampName;
public static final String TimeStampPropName = "timeStamp";
*/
public class ReadFromFile {
private FileInputStream fileStream;
- private DataInputStream dataInput;
- private BufferedReader bufferedReader;
- private String fileName;
private File filePointer;
- public ReadFromFile(String name) throws FileNotFoundException {
- fileName = name;
- fileStream = new FileInputStream(this.fileName);
+ public ReadFromFile(String fileName) throws FileNotFoundException {
+ fileStream = new FileInputStream(fileName);
filePointer = new File(fileName); //needed to allow file deletion
}
public ArrayList<String> readFile() throws IOException {
- dataInput = new DataInputStream(this.fileStream);
- bufferedReader = new BufferedReader(new InputStreamReader(dataInput));
+ DataInputStream dataInput = new DataInputStream(this.fileStream);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInput));
ArrayList<String> lineList = new ArrayList<String>();
String line;
.getLogger(WriteToFile.class);
private FileWriter fstream;
private BufferedWriter bufferOut;
- private String fileName;
- public WriteToFile(String name) throws IOException {
- fileName = name;
+ public WriteToFile(String fileName) throws IOException {
fstream = new FileWriter(fileName);
bufferOut = new BufferedWriter(fstream);
}
<id>central2</id>
<name>central2</name>
<url>http://repo2.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</pluginRepository>
<pluginRepository>
<id>opendaylight.snapshot</id>
<id>central2</id>
<name>central2</name>
<url>http://repo2.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</repository>
<repository>
<id>central</id>
<name>central</name>
<url>http://repo1.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</repository>
<!-- Pax mirror -->
<!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->
<modelVersion>4.0.0</modelVersion>
<artifactId>model-flow-base</artifactId>
-
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
--- /dev/null
+module opendaylight-flow-types {
+ namespace "urn:opendaylight:flow:types";
+ prefix flow;
+
+ import ietf-inet-types {prefix inet;}
+ import opendaylight-match-types {prefix match;}
+ import ietf-yang-types {prefix yang;}
+
+
+ revision "2013-08-19" {
+ description "Initial revision of flow service";
+ }
+
+ grouping action {
+ choice action {
+ case output-action {
+ leaf-list output-node-connector {
+ type inet:uri;
+ }
+ }
+
+ case controller-action {
+ leaf max-length {
+ type uint16 {
+ range "0..65294";
+ }
+ }
+ }
+
+ case set-queue-action {
+ leaf queue {
+ type string; // TODO: define queues
+ }
+ }
+
+ case pop-mpls-action {
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
+ }
+
+ case set-mpls-ttl-action {
+ leaf mpls-ttl {
+ type uint8;
+ }
+ }
+
+ case set-nw-ttl-action {
+ leaf nw-ttl {
+ type uint8;
+ }
+ }
+
+ case push-pbb-action {
+
+ }
+
+ case push-mpls-action {
+
+ }
+
+ case push-vlan-action {
+
+ }
+ }
+ }
+
+ grouping flow {
+ container match {
+ uses match:match;
+ }
+ list action {
+ key "order";
+ leaf order {
+ type int32;
+ }
+ uses action;
+ }
+ }
+
+ grouping flow-statistics {
+ leaf packet-count {
+ type yang:counter64;
+ }
+
+ leaf byte-count {
+ type yang:counter64;
+ }
+
+ container duration {
+ leaf second {
+ type yang:counter64;
+ }
+ leaf nanosecond {
+ type yang:counter64;
+ }
+ }
+ }
+
+ grouping flow-table-statistics {
+ leaf active {
+ type yang:counter64;
+ }
+
+ leaf lookup {
+ type yang:counter64;
+ }
+
+ leaf matched {
+ type yang:counter64;
+ }
+ }
+}
\ No newline at end of file
-module opendaylight-flow-base {
- namespace "urn:opendaylight:flow:base";
- prefix "flowbase";
+module opendaylight-match-types {
+ namespace "urn:opendaylight:model:match:types";
+ prefix "match";
- import yang-ext {prefix ext;}
import ietf-inet-types {prefix inet;}
import ietf-yang-types {prefix yang;}
- import opendaylight-inventory {prefix inv;}
import opendaylight-l2-types {prefix l2t;}
revision "2013-08-19" {
description "Initial revision of flow service";
}
+ grouping "mac-address-filter" {
+ leaf address {
+ mandatory true;
+ type yang:mac-address;
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+
/** Match Groupings **/
grouping "ethernet-match-fields" {
container ethernet-source {
- //description "Ethernet source address.";
- //presence "Match field is active and set";
- leaf address {
- mandatory true;
- type yang:mac-address;
- }
- leaf mask {
- type binary;
- }
+ description "Ethernet source address.";
+ presence "Match field is active and set";
+ uses mac-address-filter;
}
container ethernet-destination {
description "Ethernet destination address.";
presence "Match field is active and set";
- leaf address {
- mandatory true;
- type yang:mac-address;
- }
+ uses mac-address-filter;
}
container ethernet-type {
description "Ethernet frame type.";
description "VLAN priority.";
type l2t:vlan-pcp;
}
-
-
}
grouping "ip-match-fields" {
}
}
-
grouping "udp-match-fields" {
leaf udp-source-port {
description "UDP source port.";
}
}
- grouping "arp-match-fields" {
+ grouping "arp-match-fields" {
leaf arp-source-transport-address {
description "ARP source IPv4 address.";
type inet:ipv4-prefix;
container arp-source-hardware-address {
description "ARP source hardware address.";
presence "Match field is active and set";
- leaf address {
- mandatory true;
- type yang:mac-address;
- }
- leaf mask {
- type binary;
- }
+ uses mac-address-filter;
}
container arp-target-hardware-address {
description "ARP target hardware address.";
presence "Match field is active and set";
- leaf address {
- mandatory true;
- type yang:mac-address;
- }
- leaf mask {
- type binary;
- }
+ uses mac-address-filter;
}
}
grouping action {
choice action {
case output-action {
- leaf output-node-connector {
+ leaf-list output-node-connector {
type string;
}
}
}
}
- grouping flow {
- leaf node {
- type inv:node-id;
+
+ grouping match {
+ container "ethernet-match" {
+ uses "ethernet-match-fields";
}
- container match {
- container "ethernet-match" {
- uses "ethernet-match-fields";
- }
- container "vlan-match" {
- uses "vlan-match-fields";
- }
- container "ip-match" {
- uses "ip-match-fields";
- }
- container "ipv4-match" {
+ container "vlan-match" {
+ uses "vlan-match-fields";
+ }
+ container "ip-match" {
+ uses "ip-match-fields";
+ }
+
+ choice layer-3-match {
+ case "ipv4-match" {
uses "ipv4-match-fields";
}
- container "ipv6-match" {
+ case "ipv6-match" {
uses "ipv6-match-fields";
}
- container "udp-match" {
+ case "arp-match" {
+ uses "arp-match-fields";
+ }
+ }
+
+ choice layer-4-match {
+ case "udp-match" {
uses "udp-match-fields";
}
- container "tcp-match" {
+ case "tcp-match" {
uses "tcp-match-fields";
}
- container "sctp-match" {
+ case "sctp-match" {
uses "sctp-match-fields";
}
- container "icmpv4-match" {
- uses "icmpv4-match-fields";
- }
- container "arp-match" {
- uses "arp-match-fields";
- }
}
- list action {
- key "order";
- leaf order {
- type int32;
- }
- uses action;
+ container "icmpv4-match" {
+ uses "icmpv4-match-fields";
}
}
}
\ No newline at end of file
--- /dev/null
+module sal-flow {
+ namespace "urn:opendaylight:flow:service";
+ prefix flow;
+
+ import yang-ext {prefix ext;}
+ import opendaylight-inventory {prefix inv;}
+ import ietf-inet-types {prefix inet;}
+ import opendaylight-flow-types {prefix types;}
+
+
+ revision "2013-08-19" {
+ description "Initial revision of flow service";
+ }
+
+
+ typedef flow-table-ref {
+ type instance-identifier;
+ }
+
+ grouping node-flow {
+ leaf node {
+ type inv:node-ref;
+ }
+ leaf flow-table {
+ type flow-table-ref;
+ }
+ uses types:flow;
+ }
+
+ /** Base configuration structure **/
+ grouping flow-update {
+ container original-flow {
+ uses types:flow;
+ }
+ container updated-flow {
+ uses types:flow;
+ }
+ }
+
+ rpc add-flow {
+ input {
+ uses node-flow;
+ }
+ }
+
+ rpc remove-flow {
+ input {
+ uses node-flow;
+ }
+ }
+
+ rpc update-flow {
+ input {
+ uses node-flow;
+ }
+ }
+
+ notification flow-added {
+ uses node-flow;
+ }
+
+ notification flow-updated {
+ uses node-flow;
+ }
+
+ notification flow-removed {
+ uses node-flow;
+ }
+
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "flow-capable-node";
+ container flow-tables {
+ list table {
+ key "id";
+ leaf "id" {
+ type inet:uri;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-module opendaylight-flow-config {
- namespace "urn:opendaylight:flow:config";
- prefix flow;
-
- import yang-ext {prefix ext;}
- import opendaylight-inventory {prefix inv;}
- import opendaylight-flow-base {prefix flowbase;}
-
- revision "2013-08-19" {
- description "Initial revision of flow service";
- }
-
- /** Base configuration structure
- container flows {
- list flow {
- uses flowbase:flow;
- }
- }
-
- **/
-}
\ No newline at end of file
+++ /dev/null
-module opendaylight-flow-service {
- namespace "urn:opendaylight:flow:service";
- prefix flow;
-
- import yang-ext {prefix ext;}
- import opendaylight-inventory {prefix inv;}
- import opendaylight-flow-base {prefix flowbase;}
-
- revision "2013-08-19" {
- description "Initial revision of flow service";
- }
-
- /** Base configuration structure **/
-
-
- grouping flow-update {
- container original-flow {
- uses flowbase:flow;
- }
- container updated-flow {
- uses flowbase:flow;
- }
- }
-
- rpc add-flow {
- input {
- uses flowbase:flow;
- }
- }
-
- rpc remove-flow {
- input {
- uses flowbase:flow;
- }
- }
-
- rpc update-flow {
- input {
- uses flow-update;
- }
- }
-
- notification flow-added {
- uses flowbase:flow;
- }
-
- notification flow-updated {
- input {
- uses flow-update;
- }
- }
-
- notification flow-removed {
- uses flowbase:flow;
- }
-}
\ No newline at end of file
--- /dev/null
+module packet-processing {
+ namespace "urn:opendaylight:packet:service";
+ prefix flow;
+
+ import opendaylight-inventory {prefix inv;}
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+ import opendaylight-l2-types {prefix types;}
+
+ revision "2013-07-09" {
+ description "";
+ }
+
+ grouping raw-packet {
+ leaf ingress {
+ type inv:node-connector-ref;
+ }
+ leaf payload {
+ type binary;
+ }
+ }
+
+ grouping ethernet-packet {
+ leaf source {
+ type yang:mac-address;
+ }
+
+ leaf destination {
+ type yang:mac-address;
+ }
+ }
+
+
+ notification packet-received {
+ uses raw-packet;
+ }
+
+ rpc transmit-packet {
+ input {
+ leaf egress {
+ type inv:node-connector-ref;
+ }
+ uses raw-packet;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module opendaylight-flow-statistics {
+ namespace "urn:opendaylight:flow:statistics";
+ prefix flowstat;
+
+ import yang-ext {prefix ext;}
+ import opendaylight-inventory {prefix inv;}
+ import opendaylight-flow-types {prefix flow-types;}
+ import sal-flow {prefix flow;}
+ import opendaylight-statistics-types {prefix stat-types;}
+
+ revision "2013-08-19" {
+ description "Initial revision of flow service";
+ }
+
+ rpc get-node-connector-statistics {
+ input {
+ leaf node {
+ ext:context-reference "node-context";
+ type inv:node-ref;
+ }
+ leaf node-connector {
+ type inv:node-connector-ref;
+ }
+ }
+ output {
+ uses stat-types:node-connector-statistics;
+ }
+ }
+
+ notification node-connector-statistics-updated {
+ uses stat-types:node-connector-statistics;
+ }
+
+ rpc get-flow-statistics {
+ input {
+ leaf node {
+ ext:context-reference "node-context";
+ type inv:node-ref;
+ }
+ uses flow-types:flow;
+ }
+ output {
+ uses flow-types:flow-statistics;
+ }
+ }
+
+ notification flow-statistics-updated {
+ uses flow-types:flow-statistics;
+ }
+
+ rpc get-flow-table-statistics {
+ input {
+ leaf node {
+ ext:context-reference "node-context";
+ type inv:node-ref;
+ }
+ }
+ output {
+ uses flow-types:flow-table-statistics;
+ }
+ }
+
+ notification flow-table-statistics-updated {
+ leaf flow-table {
+ type flow:flow-table-ref;
+ }
+ uses flow-types:flow-table-statistics;
+ }
+
+}
\ No newline at end of file
-module opendaylight-flow-statistics {
- namespace "urn:opendaylight:flow:statistics";
- prefix flowstat;
+module opendaylight-statistics-types {
+ namespace "urn:opendaylight:model:statistics:types";
+ prefix stat-types;
- import yang-ext {prefix ext;}
- import ietf-inet-types {prefix inet;}
- import ietf-yang-types {prefix yang;}
- import opendaylight-flow-base {prefix flow;}
import opendaylight-inventory {prefix inv;}
+
revision "2013-08-19" {
description "Initial revision of flow service";
}
- /*
- augment "/flow:flows/flow:flow" {
- ext:augment-identifier "flow-statistics";
+
- leaf packet-count {
- type uint64;
- }
-
- leaf byte-count {
- type uint64;
- }
-
- container duration {
- leaf second {
- type uint64;
- }
- leaf nanosecond {
- type uint64;
- }
- }
- }
- */
-
- augment "/inv:nodes/inv:node/inv:node-connector" {
- ext:augment-identifier "node-connector-statistics";
-
- container packets {
+ grouping node-connector-statistics {
+ container packets {
leaf received {
type uint64;
}
leaf collision-count {
type uint64;
}
-
}
-
}
\ No newline at end of file
--- /dev/null
+module opendaylight-inventory {
+ namespace "urn:opendaylight:inventory";
+ prefix inv;
+
+ import yang-ext {prefix ext;}
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+
+
+ revision "2013-08-19" {
+ description "Initial revision of Inventory model";
+ }
+
+ typedef node-id {
+ type inet:uri;
+ }
+
+ typedef node-connector-id {
+ type inet:uri;
+ }
+
+ typedef node-ref {
+ type instance-identifier;
+ }
+
+ typedef node-connector-ref {
+ type instance-identifier;
+ }
+
+ identity node-context {
+ description "Identity used to mark node context";
+ }
+
+ identity node-connector-context {
+
+ }
+
+ grouping node {
+ leaf id {
+ type node-id;
+ }
+ }
+
+ grouping node-connector {
+ leaf id {
+ type node-connector-id;
+ }
+ }
+
+
+
+
+ /** Base structure **/
+ container nodes {
+ list node {
+ key "id";
+ ext:context-instance "node-context";
+
+ uses node;
+
+ list "node-connector" {
+ key "id";
+ ext:context-instance "node-connector-context";
+
+ use node-connector;
+ }
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-module opendaylight-inventory {
- namespace "urn:opendaylight:inventory";
- prefix flow;
-
- import yang-ext {prefix ext;}
- import ietf-inet-types {prefix inet;}
- import ietf-yang-types {prefix yang;}
-
-
- revision "2013-08-19" {
- description "Initial revision of Inventory model";
- }
-
- typedef node-id {
- type inet:uri;
- }
-
- typedef node-connector-id {
- type inet:uri;
- }
-
- /** Base structure **/
- container nodes {
- list node {
- key id;
- leaf id {
- type node-id;
- }
- list node-connector {
- key "id";
- leaf id {
- type node-connector-id;
- }
- }
- }
- }
-}
\ No newline at end of file
<yang.version>0.5.7-SNAPSHOT</yang.version>
<maven.bundle.version>2.4.0</maven.bundle.version>
<releaseplugin.version>2.3.2</releaseplugin.version>
+ <guava.version>14.0.1</guava.version>
</properties>
<pluginRepositories>
<id>central2</id>
<name>central2</name>
<url>http://repo2.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</pluginRepository>
<pluginRepository>
<id>opendaylight.snapshot</id>
<id>central2</id>
<name>central2</name>
<url>http://repo2.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</repository>
<repository>
<id>central</id>
<name>central</name>
<url>http://repo1.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</repository>
<!-- EBR release -->
<!-- http://repository.springsource.com/maven/bundles/release -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>14.0.1</version>
- <type>jar</type>
+ <version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <type>jar</type>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<dependency>\r
<groupId>com.google.guava</groupId>\r
<artifactId>guava</artifactId>\r
- <type>jar</type>\r
</dependency>\r
</dependencies>\r
</project>\r
javax.xml.bind,
org.slf4j,
org.apache.catalina.filters,
+ org.codehaus.jackson.jaxrs,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Web-ContextPath>/one/nb/v2/lb</Web-ContextPath>
@ResponseCode(code = 409, condition = "VIP already exist"),
@ResponseCode(code = 415, condition = "Invalid input data")})
public Response addVIP(@PathParam("containerName") String containerName,
- @TypeHint(VIP.class) JAXBElement<VIP> inVIP){
+ @TypeHint(VIP.class) VIP inVIP){
- VIP vipInput = inVIP.getValue();
+ VIP vipInput = inVIP;
String name = vipInput.getName();
String ip = vipInput.getIp();
String protocol = vipInput.getProtocol();
@ResponseCode(code = 405, condition = "Pool already attached to the VIP"),
@ResponseCode(code = 415, condition = "Invalid input name")})
public Response updateVIP(@PathParam("containerName") String containerName,
- @TypeHint(VIP.class) JAXBElement<VIP> inVIP) {
+ @TypeHint(VIP.class) VIP inVIP) {
- VIP vipInput = inVIP.getValue();
+ VIP vipInput = inVIP;
String name = vipInput.getName();
String poolName = vipInput.getPoolName();
if(name.isEmpty() ||
@ResponseCode(code = 409, condition = "Pool already exist"),
@ResponseCode(code = 415, condition = "Invalid input data")})
public Response addPool(@PathParam("containerName") String containerName,
- @TypeHint(Pool.class) JAXBElement<Pool> inPool) {
+ @TypeHint(Pool.class) Pool inPool) {
- Pool poolInput = inPool.getValue();
+ Pool poolInput = inPool;
String name = poolInput.getName();
String lbMethod =poolInput.getLbMethod();
if(name.isEmpty() ||
@ResponseCode(code = 409, condition = "Pool member already exist"),
@ResponseCode(code = 415, condition = "Invalid input data")})
public Response addPoolMember(@PathParam("containerName") String containerName,
- @TypeHint(PoolMember.class) JAXBElement<PoolMember> inPoolMember){
+ @TypeHint(PoolMember.class) PoolMember inPoolMember){
- PoolMember pmInput = inPoolMember.getValue();
+ PoolMember pmInput = inPoolMember;
String name = pmInput.getName();
String memberIP = pmInput.getIp();
String poolName = pmInput.getPoolName();
import java.util.Set;
import javax.ws.rs.core.Application;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
/**
* This class is an instance of javax.ws.rs.core.Application and is used to return the classes
* that will be instantiated for JAXRS processing. This is necessary
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(LoadBalancerNorthbound.class);
+ classes.add(JacksonJaxbJsonProvider.class);
return classes;
}
}
@Override
public Set<Node> getNodes() {
return (nodeProps != null) ? new HashSet<Node>(nodeProps.keySet())
- : null;
+ : new HashSet<Node>();
}
/*
try {
map.put(s, new NodeConnector(entry.getValue()));
} catch (ConstructionException e) {
- e.printStackTrace();
+ log.error("An error occured",e);
}
}
}
try {
map.put(s, new NodeConnector(entry.getValue()));
} catch (ConstructionException e) {
- e.printStackTrace();
+ log.error("An error occured",e);
}
}
map.remove(name.getValue());
try {
map.put(s, new NodeConnector(entry.getValue()));
} catch (ConstructionException e) {
- e.printStackTrace();
+ log.error("An error occured",e);
}
}
map.remove(name.getValue());
},
modal: {
modal: "one_f_switchmanager_subnetGatewayConfig_id_modal_modal",
- ports : "one_f_switchmanager_subnetGatewayConfig_id_modal_ports",
+ ports : "one_f_switchmanager_subnetGatewayConfig_id_modal_ports",
save: "one_f_switchmanager_subnetGatewayConfig_id_modal_save",
+ remove: "one_f_switchmanager_subnetGatewayConfig_id_modal_remove",
+ cancel: "one_f_switchmanager_subnetGatewayConfig_id_modal_cancel",
form: {
name : "one_f_switchmanager_subnetGatewayConfig_id_modal_form_gatewayname",
gatewayIPAddress : "one_f_switchmanager_subnetGatewayConfig_id_modal_form_gatewayipaddress",
$dashlet.append($button);
// Delete gateway ip address button
- var button = one.lib.dashlet.button.single("Delete Gateway IP Address",
- one.f.switchmanager.subnetGatewayConfig.id.dashlet.removeIPAddress, "btn-danger", "btn-mini");
+ var button = one.lib.dashlet.button.single("Remove Gateway IP Address",
+ one.f.switchmanager.subnetGatewayConfig.id.dashlet.removeIPAddress, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
- var requestData = {};
var gatewaysToDelete = [];
var checkedCheckBoxes = $("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).find("tbody input:checked")
checkedCheckBoxes.each(function(index, value) {
gatewaysToDelete.push(checkedCheckBoxes[index].id);
});
if (checkedCheckBoxes.size() === 0) {
- alert('Please select at least one gateway');
- return false;
- }
- if (gatewaysToDelete.length > 0) {
- requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
- var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
- one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
- if (response.status == true) {
- // refresh dashlet by passing dashlet div as param
- one.lib.alert("Subnet Gateway(s) successfully removed");
- } else {
- one.lib.alert(response.message);
- }
- one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
- });
+ return false;
}
+ one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.dialog(gatewaysToDelete)
});
$dashlet.append($button);
var $saveButton = one.lib.dashlet.button.button(saveButton);
footer.push($saveButton);
return footer;
+ },
+ removeMultiple: {
+ dialog: function(gatewaysToDelete) {
+ var h3 = 'Remove Gateway IP Address';
+
+ var footer = one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.footer();
+ var $body = one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.body(gatewaysToDelete);
+ var $modal = one.lib.modal.spawn(one.f.switchmanager.subnetGatewayConfig.id.modal.modal, h3, $body, footer);
+
+ // bind close button
+ $('#'+one.f.switchmanager.subnetGatewayConfig.id.modal.cancel, $modal).click(function() {
+ $modal.modal('hide');
+ });
+
+ // bind remove rule button
+ $('#'+one.f.switchmanager.subnetGatewayConfig.id.modal.remove, $modal).click(this, function(e) {
+ var requestData = {};
+ if (gatewaysToDelete.length > 0) {
+ requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
+ var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
+ one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
+ $modal.modal('hide');
+ if (response.status == true) {
+ // refresh dashlet by passing dashlet div as param
+ one.lib.alert("Gateway IP Address(es) successfully removed");
+ } else {
+ alert(response.message);
+ }
+ one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
+ });
+ }
+ });
+ $modal.modal();
+ },
+ footer : function() {
+ var footer = [];
+ var remove = one.lib.dashlet.button.single('Remove Gateway IP Address',one.f.switchmanager.subnetGatewayConfig.id.modal.remove, 'btn-danger', '');
+ var $remove = one.lib.dashlet.button.button(remove);
+ footer.push($remove);
+
+ var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.subnetGatewayConfig.id.modal.cancel, '', '');
+ var $cancel = one.lib.dashlet.button.button(cancel);
+ footer.push($cancel);
+
+ return footer;
+ },
+ body : function (gatewayList) {
+ var $p = $(document.createElement('p'));
+ var p = 'Remove the following Gateway IP Address(es)?';
+ //creata a BS label for each rule and append to list
+ $(gatewayList).each(function(){
+ var $span = $(document.createElement('span'));
+ $span.append(this);
+ p += '<br/>' + $span[0].outerHTML;
+ });
+ $p.append(p);
+ return $p;
+ }
}
},
// data functions
nodePortHtml += " ";
nodePortHtml += '<a href="#" id=' + encodeURIComponent(nodePortID) +
' gatewayName=' + tableRow["name"] +
- ' onclick="javascript:one.f.switchmanager.subnetGatewayConfig.actions.deleteNodePort(this);">Delete</a>';
+ ' onclick="javascript:one.f.switchmanager.subnetGatewayConfig.actions.deleteNodePort(this);">Remove</a>';
nodePortHtml += "<br/>";
});
nodePortHtml += "</div>";
aTag.addEventListener("mouseover", function(evt) {
evt.target.style.cursor = "pointer";
}, false);
- aTag.innerHTML = "Delete";
+ aTag.innerHTML = "Remove";
$nodePortsContainer.append(aTag);
$nodePortsContainer.append("<br/>");
}
modal: {
modal: "one_f_switchmanager_staticRouteConfig_id_modal_modal",
save: "one_f_switchmanager_staticRouteConfig_id_modal_save",
+ cancel: "one_f_switchmanager_staticRouteConfig_id_modal_cancel",
+ remove: "one_f_switchmanager_staticRouteConfig_id_modal_remove",
form: {
routeName : "one_f_switchmanager_staticRouteConfig_id_modal_form_routename",
staticRoute : "one_f_switchmanager_staticRouteConfig_id_modal_form_staticroute",
$dashlet.append($button);
// Delete static route button
- var button = one.lib.dashlet.button.single("Delete Static Route(s)", one.f.switchmanager.staticRouteConfig.id.dashlet.remove, "btn-danger", "btn-mini");
+ var button = one.lib.dashlet.button.single("Remove Static Route", one.f.switchmanager.staticRouteConfig.id.dashlet.remove, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
- var requestData = {};
var routesToDelete = [];
- //var checkedCheckBoxes = $("input:checked", $(this).closest(".dashlet").find("table"));
var checkedCheckBoxes = $("#" + one.f.switchmanager.staticRouteConfig.id.dashlet.datagrid).find("tbody input:checked");
checkedCheckBoxes.each(function(index, value) {
routesToDelete.push(checkedCheckBoxes[index].id);
});
if (checkedCheckBoxes.size() === 0) {
- alert('Please select at least one static route');
- return false;
- }
- if (routesToDelete.length > 0) {
- requestData["routesToDelete"] = routesToDelete.toString();
- var url = one.f.switchmanager.rootUrl + "/staticRoute/delete";
- one.f.switchmanager.staticRouteConfig.ajax.main(url, requestData, function(response) {
- if (response.status == true) {
- // refresh dashlet by passing dashlet div as param
- one.lib.alert("Static Routes(s) successfully removed");
- } else {
- one.lib.alert(response.message);
- }
- one.f.switchmanager.staticRouteConfig.dashlet($("#left-bottom .dashlet"));
- });
+ return false;
}
+ one.f.switchmanager.staticRouteConfig.modal.removeMultiple.dialog(routesToDelete);
});
$dashlet.append($button);
}
var $saveButton = one.lib.dashlet.button.button(saveButton);
footer.push($saveButton);
return footer;
+ },
+ removeMultiple: {
+ dialog: function(routesToDelete) {
+ var h3 = 'Remove Static Route';
+
+ var footer = one.f.switchmanager.staticRouteConfig.modal.removeMultiple.footer();
+ var $body = one.f.switchmanager.staticRouteConfig.modal.removeMultiple.body(routesToDelete);
+ var $modal = one.lib.modal.spawn(one.f.switchmanager.staticRouteConfig.id.modal.modal, h3, $body, footer);
+
+ // bind close button
+ $('#'+one.f.switchmanager.staticRouteConfig.id.modal.cancel, $modal).click(function() {
+ $modal.modal('hide');
+ });
+
+ // bind remove rule button
+ $('#'+one.f.switchmanager.staticRouteConfig.id.modal.remove, $modal).click(this, function(e) {
+ if (routesToDelete.length > 0) {
+ var requestData = {};
+ requestData["routesToDelete"] = routesToDelete.toString();
+ var url = one.f.switchmanager.rootUrl + "/staticRoute/delete";
+ one.f.switchmanager.staticRouteConfig.ajax.main(url, requestData, function(response) {
+ $modal.modal('hide');
+ if (response.status == true) {
+ // refresh dashlet by passing dashlet div as param
+ one.lib.alert("Static Route(s) successfully removed");
+ } else {
+ alert(response.message);
+ }
+ one.f.switchmanager.staticRouteConfig.dashlet($("#left-bottom .dashlet"));
+ });
+ }
+ });
+ $modal.modal();
+ },
+ footer : function() {
+ var footer = [];
+ var remove = one.lib.dashlet.button.single('Remove Static Route',one.f.switchmanager.staticRouteConfig.id.modal.remove, 'btn-danger', '');
+ var $remove = one.lib.dashlet.button.button(remove);
+ footer.push($remove);
+
+ var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.staticRouteConfig.id.modal.cancel, '', '');
+ var $cancel = one.lib.dashlet.button.button(cancel);
+ footer.push($cancel);
+
+ return footer;
+ },
+ body : function (staticRouteList) {
+ var $p = $(document.createElement('p'));
+ var p = 'Remove the following Static Route(s)?';
+ //creata a BS label for each rule and append to list
+ $(staticRouteList).each(function(){
+ var $span = $(document.createElement('span'));
+ $span.append(this);
+ p += '<br/>' + $span[0].outerHTML;
+ });
+ $p.append(p);
+ return $p;
+ }
}
},
// data functions
modal: {
modal: "one_f_switchmanager_spanPortConfig_id_modal_modal",
save: "one_f_switchmanager_spanPortConfig_id_modal_save",
+ cancel: "one_f_switchmanager_spanPortConfig_id_modal_cancel",
+ remove: "one_f_switchmanager_spanPortConfig_id_modal_remove",
form: {
name : "one_f_switchmanager_spanPortConfig_id_modal_form_name",
nodes : "one_f_switchmanager_spanPortConfig_id_modal_form_nodes",
$dashlet.append($button);
// Delete span port button
- var button = one.lib.dashlet.button.single("Delete SPAN Port(s)", one.f.switchmanager.spanPortConfig.id.dashlet.remove, "btn-danger", "btn-mini");
+ var button = one.lib.dashlet.button.single("Remove SPAN Port", one.f.switchmanager.spanPortConfig.id.dashlet.remove, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
-
+ var spanPortsToDelete = [];
var checkedCheckBoxes = $("#" + one.f.switchmanager.spanPortConfig.id.dashlet.datagrid).find("tbody input:checked");
- if (checkedCheckBoxes.length > 0) {
- var spanPortsToDelete = "";
- checkedCheckBoxes.each(function(index, value) {
- spanPortsToDelete += decodeURIComponent(checkedCheckBoxes[index].getAttribute("spanPort")) + "###";
- });
- if (checkedCheckBoxes.size() === 0) {
- alert('Please select at least one SPAN port');
- return false;
- }
-
- var requestData = {};
- requestData["spanPortsToDelete"] = spanPortsToDelete;
- var url = one.f.switchmanager.rootUrl + "/spanPorts/delete";
- one.f.switchmanager.spanPortConfig.ajax.main(url, requestData, function(response) {
- if (response.status == true) {
- // refresh dashlet by passing dashlet div as param
- one.lib.alert("Span Port(s) successfully removed");
- } else {
- one.lib.alert(response.message);
- }
- one.f.switchmanager.spanPortConfig.dashlet($("#right-bottom .dashlet"));
- });
+
+ if (checkedCheckBoxes.size() === 0) {
+ return false;
}
+ checkedCheckBoxes.each(function(index, value) {
+ spanPortsToDelete.push(decodeURIComponent(checkedCheckBoxes[index].getAttribute("spanPort")));
+ });
+ one.f.switchmanager.spanPortConfig.modal.removeMultiple.dialog(spanPortsToDelete);
});
$dashlet.append($button);
}
var $saveButton = one.lib.dashlet.button.button(saveButton);
footer.push($saveButton);
return footer;
+ },
+ removeMultiple: {
+ dialog: function(spanPortsToDelete) {
+ var h3 = 'Remove Span Port';
+
+ var footer = one.f.switchmanager.spanPortConfig.modal.removeMultiple.footer();
+ var $body = one.f.switchmanager.spanPortConfig.modal.removeMultiple.body(spanPortsToDelete);
+ var $modal = one.lib.modal.spawn(one.f.switchmanager.spanPortConfig.id.modal.modal, h3, $body, footer);
+
+ // bind close button
+ $('#'+one.f.switchmanager.spanPortConfig.id.modal.cancel, $modal).click(function() {
+ $modal.modal('hide');
+ });
+
+ // bind remove rule button
+ $('#'+one.f.switchmanager.spanPortConfig.id.modal.remove, $modal).click(this, function(e) {
+ var requestData = {};
+ var spanPorts="";
+ $(spanPortsToDelete).each(function(){
+ spanPorts = spanPorts + "###" + this.toString();
+ });
+ requestData["spanPortsToDelete"] = spanPorts.slice(3,spanPorts.length);
+
+ var url = one.f.switchmanager.rootUrl + "/spanPorts/delete";
+ one.f.switchmanager.spanPortConfig.ajax.main(url, requestData, function(response) {
+ $modal.modal('hide');
+ if (response.status == true) {
+ // refresh dashlet by passing dashlet div as param
+ one.lib.alert("Span Port(s) successfully removed");
+ } else {
+ alert(response.message);
+ }
+ one.f.switchmanager.spanPortConfig.dashlet($("#right-bottom .dashlet"));
+ });
+ });
+ $modal.modal();
+ },
+ footer : function() {
+ var footer = [];
+ var remove = one.lib.dashlet.button.single('Remove SPAN Port',one.f.switchmanager.spanPortConfig.id.modal.remove, 'btn-danger', '');
+ var $remove = one.lib.dashlet.button.button(remove);
+ footer.push($remove);
+
+ var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.spanPortConfig.id.modal.cancel, '', '');
+ var $cancel = one.lib.dashlet.button.button(cancel);
+ footer.push($cancel);
+
+ return footer;
+ },
+ body : function (spanPortToDelete) {
+ var $p = $(document.createElement('p'));
+ var p = 'Remove the following Span Port(s)?';
+ //creata a BS label for each rule and append to list
+
+ var spanPortList = JSON.parse("["+spanPortToDelete.toString()+"]");
+ $(spanPortList).each(function(){
+ var $span = $(document.createElement('span'));
+ $span.append(this.nodeId+"-"+this.spanPort);
+ p += '<br/>' + $span[0].outerHTML;
+ });
+ $p.append(p);
+ return $p;
+ }
}
},
// data functions
$button.click(function() {
var checkedCheckBoxes = $('.flowEntry[type=checkbox]:checked');
if (checkedCheckBoxes.size() === 0) {
- alert('Please select at least one flow');
- return false;
+ return false;
}
var requestData = [];
- var resource = {};
checkedCheckBoxes.each(function(index, value) {
var flowEntry = {};
flowEntry['name'] = checkedCheckBoxes[index].name;
flowEntry['node'] = checkedCheckBoxes[index].getAttribute("node");
requestData.push(flowEntry);
});
- resource['body'] = JSON.stringify(requestData);
-
- $.post(one.f.address.root+one.f.address.flows.deleteFlows, resource, function(response) {
- if(response == "Success") {
- one.lib.alert("Flow(s) successfully removed");
- } else {
- one.lib.alert(response);
- }
- one.main.dashlet.right.bottom.empty();
- one.f.detail.dashlet(one.main.dashlet.right.bottom);
- one.main.dashlet.left.top.empty();
- one.f.flows.dashlet(one.main.dashlet.left.top);
- });
+ one.f.flows.modal.removeMultiple.dialog(requestData);
});
$dashlet.append($button);
modal : {
dialog : {
initialize : function(id, node) {
- var h3 = "Remove Flow?";
+ var h3 = "Remove Flow";
var $p = one.f.flows.modal.dialog.body(id);
var footer = one.f.flows.modal.dialog.footer();
var $modal = one.lib.modal.spawn(one.f.flows.id.modal.dialog.modal, h3, $p, footer);
one.f.flows.modal.ajax.saveflow(resource, function(data) {
if (data == "Success") {
$modal.modal('hide');
- one.lib.alert('Flow added');
+ one.lib.alert('Flow Entry added');
one.main.dashlet.left.top.empty();
one.f.flows.dashlet(one.main.dashlet.left.top);
} else {
footer.push($closeButton);
return footer;
+ },
+ removeMultiple: {
+ dialog: function(flows) {
+ var h3 = 'Remove Flow Entry';
+ var flowList = [];
+ for (var i = 0; i < flows.length; i++) {
+ flowList.push(flows[i]["name"]);
+ }
+ var footer = one.f.flows.modal.removeMultiple.footer();
+ var $body = one.f.flows.modal.removeMultiple.body(flowList);
+ var $modal = one.lib.modal.spawn(one.f.flows.id.modal.dialog.modal, h3, $body, footer);
+
+ // bind close button
+ $('#'+one.f.flows.id.modal.dialog.close, $modal).click(function() {
+ $modal.modal('hide');
+ });
+
+ // bind remove rule button
+ $('#'+one.f.flows.id.modal.dialog.remove, $modal).click(this, function(e) {
+ var resource = {};
+ resource['body'] = JSON.stringify(flows);
+
+ $.post(one.f.address.root+one.f.address.flows.deleteFlows, resource, function(response) {
+ $modal.modal('hide');
+ if(response == "Success") {
+ one.lib.alert("Flow Entry(s) successfully removed");
+ } else {
+ one.lib.alert(response);
+ }
+ one.main.dashlet.right.bottom.empty();
+ one.f.detail.dashlet(one.main.dashlet.right.bottom);
+ one.main.dashlet.left.top.empty();
+ one.f.flows.dashlet(one.main.dashlet.left.top);
+ });
+ });
+ $modal.modal();
+ },
+ footer : function() {
+ var footer = [];
+ var remove = one.lib.dashlet.button.single('Remove Flow Entry',one.f.flows.id.modal.dialog.remove, 'btn-danger', '');
+ var $remove = one.lib.dashlet.button.button(remove);
+ footer.push($remove);
+
+ var cancel = one.lib.dashlet.button.single('Cancel', one.f.flows.id.modal.dialog.close, '', '');
+ var $cancel = one.lib.dashlet.button.button(cancel);
+ footer.push($cancel);
+
+ return footer;
+ },
+ body : function (flows) {
+ var $p = $(document.createElement('p'));
+ var p = 'Remove the following Flow Entry(s)?';
+ //creata a BS label for each rule and append to list
+ $(flows).each(function(){
+ var $span = $(document.createElement('span'));
+ $span.append(this);
+ p += '<br/>' + $span[0].outerHTML;
+ });
+ $p.append(p);
+ return $p;
+ }
}
},
ajax : {
// activate first tab on each dashlet
$('.dash .nav').each(function(index, value) {
$($(value).find('li')[0]).find('a').click();
-});
+});
\ No newline at end of file
return null;
}
- List<ClusterNodeBean> clusters = new ArrayList<ClusterNodeBean>();
+ List<ClusterNodeBean> clusterNodes = new ArrayList<ClusterNodeBean>();
List<InetAddress> controllers = clusterServices.getClusteredControllers();
for (InetAddress controller : controllers) {
if (controller.equals(clusterServices.getMyAddress())) {
clusterBeanBuilder.highlightMe();
}
- if (clusterServices.amICoordinator()) {
+ if (clusterServices.getCoordinatorAddress().equals(controller)) {
clusterBeanBuilder.iAmCoordinator();
}
-
- clusters.add(clusterBeanBuilder.build());
+ clusterNodes.add(clusterBeanBuilder.build());
}
- return gson.toJson(clusters);
+ return gson.toJson(clusterNodes);
}
/**
* Return nodes connected to controller {controller}
- * @param cluster
+ * @param controller
* - byte[] of the address of the controller
* @return List<NodeBean>
*/
@RequestMapping("/cluster/controller/{controller}")
@ResponseBody
- public String getNodesConnectedToController(@PathVariable("controller") String cluster) {
+ public String getNodesConnectedToController(@PathVariable("controller") String controller) {
IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance(
IClusterGlobalServices.class, this);
if (clusterServices == null) {
return null;
}
- byte[] address = gson.fromJson(cluster, byte[].class);
- InetAddress clusterAddress = null;
+ byte[] address = gson.fromJson(controller, byte[].class);
+ InetAddress controllerAddress = null;
try {
- clusterAddress = InetAddress.getByAddress(address);
+ controllerAddress = InetAddress.getByAddress(address);
} catch (UnknownHostException e) {
return null;
}
- InetAddress thisCluster = clusterServices.getMyAddress();
List<NodeBean> result = new ArrayList<NodeBean>();
- Set<Node> nodes = connectionManager.getNodes(thisCluster);
+ Set<Node> nodes = connectionManager.getNodes(controllerAddress);
+ if (nodes == null) {
+ return gson.toJson(result);
+ }
for (Node node : nodes) {
Description description = (Description) switchManager.getNodeProp(node, Description.propertyName);
NodeBean nodeBean;
close : 'one-main-cluster-id-close',
datagrid : 'one-main-cluster-id-datagrid'
},
- registry : { // one.main.cluster.registry
- cluster : undefined
- },
initialize : function() {
var h3 = 'Cluster Management';
var footer = one.main.cluster.footer();
if ($tr.find('td:nth-child(1)').attr('colspan') === '1') {
return false;
}
- var address = one.main.cluster.registry.cluster[$tr.index()];
+ var address = $tr.find('.ux-id').text();
one.main.cluster.nodes.initialize(address);
});
});
var registry = [];
$(data).each(function(idx, val) {
var name = val.name;
+ var address = val.address;
+ var $registry = $(document.createElement('span'));
+ $registry
+ .append(JSON.stringify(address))
+ .css('display', 'none')
+ .addClass('ux-id');
name = one.lib.dashlet.label(name, null)[0].outerHTML;
+ name += $registry[0].outerHTML;
if (val.me === true) {
var me = one.lib.dashlet.label('*', 'label-inverse')[0].outerHTML;
name += ' '+me;
tdata.push({
'controller' : name
});
- registry.push(val.address);
});
- one.main.cluster.registry.cluster = registry;
var source = new StaticDataSource({
columns : [
{
});
// body
- $.getJSON('/admin/cluster/controller/'+JSON.stringify(address), function(data) {
+ $.getJSON('/admin/cluster/controller/'+address, function(data) {
var $gridHTML = one.lib.dashlet.datagrid.init(one.main.cluster.nodes.id.datagrid, {
searchable: true,
filterable: false,