--- /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
<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 -->
# 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");
"User is not authorized to perform this operation on container "
+ containerName);
}
+ if (flowConfig.getValue().getNode() == null) {
+ return Response.status(Response.Status.BAD_REQUEST).entity("Invalid Configuration. Node is null or empty")
+ .build();
+ }
handleResourceCongruence(name, flowConfig.getValue().getName());
handleResourceCongruence(nodeId, flowConfig.getValue().getNode().getNodeIDString());
handleDefaultDisabled(containerName);
<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>
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 {
<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
@Override
public Set<Node> getNodes() {
return (nodeProps != null) ? new HashSet<Node>(nodeProps.keySet())
- : null;
+ : new HashSet<Node>();
}
/*
},
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,