aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/tools')
-rwxr-xr-xframework/src/onos/tools/dev/bin/onos-setup-karaf2
-rw-r--r--framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json35
-rw-r--r--framework/src/onos/tools/package/config/samples/network-cfg.json1
-rw-r--r--framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java5
-rw-r--r--framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml1
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-gen-partitions20
-rw-r--r--framework/src/onos/tools/test/cells/jian11
-rw-r--r--framework/src/onos/tools/test/cells/simon11
-rw-r--r--framework/src/onos/tools/test/configs/netconf-cfg.json19
-rwxr-xr-xframework/src/onos/tools/test/topos/metro.py217
10 files changed, 310 insertions, 12 deletions
diff --git a/framework/src/onos/tools/dev/bin/onos-setup-karaf b/framework/src/onos/tools/dev/bin/onos-setup-karaf
index cbe62253..7a0493d1 100755
--- a/framework/src/onos/tools/dev/bin/onos-setup-karaf
+++ b/framework/src/onos/tools/dev/bin/onos-setup-karaf
@@ -59,7 +59,7 @@ if [ ! -d $KARAF_ROOT ]; then
# Check if Apache Karaf bits are available and if not, fetch them.
if [ ! -f $KARAF_TAR ]; then
echo "Downloading $KARAF_TAR..."
- curl -sL http://downloads.onosproject.org/third-party/apache-karaf-$KARAF_VERSION.tar.gz > $KARAF_TAR
+ curl -sL http://downloads.onosproject.org/third-party/apache-karaf-$KARAF_VERSION.tar.gz --create-dirs -o $KARAF_TAR
fi
[ ! -f $KARAF_ZIP -a ! -f $KARAF_TAR ] && \
echo "Apache Karaf bits $KARAF_ZIP or $KARAF_TAR not found" && exit 1
diff --git a/framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json b/framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json
new file mode 100644
index 00000000..fcc805f9
--- /dev/null
+++ b/framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json
@@ -0,0 +1,35 @@
+{
+ "ports": {
+ "of:0000000000000002/3": {
+ "linkDiscovery": {
+ "enabled": false
+ }
+ },
+ "of:0000000000000002/2": {
+ "linkDiscovery": {
+ "enabled": false
+ }
+ }
+ },
+ "devices": {
+ "of:0000000000000001": {
+ "linkDiscovery": {
+ "enabled": false
+ }
+ }
+ },
+ "apps": {
+ "org.onosproject.provider.lldp": {
+ "suppression": {
+ "deviceTypes": [
+ "ROADM"
+ ],
+ "annotation": {
+ "no-lldp": null,
+ "sendLLDP": "false"
+ }
+ }
+ }
+ }
+}
+
diff --git a/framework/src/onos/tools/package/config/samples/network-cfg.json b/framework/src/onos/tools/package/config/samples/network-cfg.json
index 92328479..9e9257e0 100644
--- a/framework/src/onos/tools/package/config/samples/network-cfg.json
+++ b/framework/src/onos/tools/package/config/samples/network-cfg.json
@@ -64,3 +64,4 @@
}
}
}
+
diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
index a75127a3..0ee5382e 100644
--- a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
+++ b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
@@ -66,6 +66,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
private static final String PRODUCES = "javax.ws.rs.Produces";
private static final String CONSUMES = "javax.ws.rs.Consumes";
private static final String JSON = "MediaType.APPLICATION_JSON";
+ private static final String OCTET_STREAM = "MediaType.APPLICATION_OCTET_STREAM";
/**
* The directory where the generated catalogue file will be put.
@@ -261,7 +262,6 @@ public class OnosSwaggerMojo extends AbstractMojo {
addSummaryDescriptions(methodNode, comment);
addJsonSchemaDefinition(definitions, tag);
- addJsonSchemaDefinition(definitions, tag);
processParameters(javaMethod, methodNode, method, tag);
@@ -327,7 +327,6 @@ public class OnosSwaggerMojo extends AbstractMojo {
}
// Temporary solution to add responses to a method
- // TODO Provide annotations in the web resources for responses and parse them
private void addResponses(ObjectNode methodNode, DocletTag tag, boolean responseJson) {
ObjectNode responses = mapper.createObjectNode();
methodNode.set("responses", responses);
@@ -352,6 +351,8 @@ public class OnosSwaggerMojo extends AbstractMojo {
private String getIOType(JavaAnnotation annotation) {
if (annotation.getNamedParameter("value").toString().equals(JSON)) {
return "application/json";
+ } else if (annotation.getNamedParameter("value").toString().equals(OCTET_STREAM)){
+ return "application/octet_stream";
}
return "";
}
diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml b/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml
index d5a91e2a..5b08d80a 100644
--- a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml
+++ b/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml
@@ -15,7 +15,6 @@
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
- <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
diff --git a/framework/src/onos/tools/test/bin/onos-gen-partitions b/framework/src/onos/tools/test/bin/onos-gen-partitions
index 35195b04..5da0807d 100755
--- a/framework/src/onos/tools/test/bin/onos-gen-partitions
+++ b/framework/src/onos/tools/test/bin/onos-gen-partitions
@@ -1,19 +1,20 @@
-#!/usr/bin/env python
-'''
+#!/usr/bin/env python
+"""
Generate the partitions json file from the $OC* environment variables
-
+
Usage: onos-gen-partitions [output file]
If output file is not provided, the json is written to stdout.
-'''
+"""
from os import environ
from collections import deque, OrderedDict
import re
import json
import sys
+import hashlib
-convert = lambda text: int(text) if text.isdigit() else text.lower()
-alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
+convert = lambda text: int(text) if text.isdigit() else text.lower()
+alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
def get_OC_vars():
vars = []
@@ -42,10 +43,13 @@ if __name__ == '__main__':
vars = get_OC_vars()
nodes = get_nodes(vars)
partitions = generate_permutations([v.get('id') for v in nodes], 3)
+ name = 0
+ for node in nodes:
+ name = name ^ hash(node['ip'])
data = {
- 'name': 'default',
+ 'name': name,
'nodes': nodes,
- 'partitions': partitions
+ 'partitions': partitions
}
output = json.dumps(data, indent=4)
diff --git a/framework/src/onos/tools/test/cells/jian b/framework/src/onos/tools/test/cells/jian
new file mode 100644
index 00000000..d9808d59
--- /dev/null
+++ b/framework/src/onos/tools/test/cells/jian
@@ -0,0 +1,11 @@
+# Jian's ProxMox ONOS instances 1,2,3 & ONOS mining box
+
+export ONOS_NIC="10.128.1.*"
+export OC1="10.128.1.1"
+export OC2="10.128.1.2"
+export OC3="10.128.1.3"
+export OCN="10.128.1.4"
+
+export OCT=$OC1
+export ONOS_USE_SSH=true
+export ONOS_APPS=drivers,openflow,proxyarp,mobility \ No newline at end of file
diff --git a/framework/src/onos/tools/test/cells/simon b/framework/src/onos/tools/test/cells/simon
new file mode 100644
index 00000000..71883358
--- /dev/null
+++ b/framework/src/onos/tools/test/cells/simon
@@ -0,0 +1,11 @@
+# Simon's ProxMox ONOS instances 1,2,3 & ONOS mininet box
+
+export ONOS_NIC="10.128.2.*"
+export OC1="10.128.2.1"
+export OC2="10.128.2.2"
+export OC3="10.128.2.3"
+export OCN="10.128.2.4"
+
+export OCT=$OC1
+export ONOS_USE_SSH=true
+export ONOS_APPS=drivers,openflow,proxyarp,mobility \ No newline at end of file
diff --git a/framework/src/onos/tools/test/configs/netconf-cfg.json b/framework/src/onos/tools/test/configs/netconf-cfg.json
new file mode 100644
index 00000000..42778aaf
--- /dev/null
+++ b/framework/src/onos/tools/test/configs/netconf-cfg.json
@@ -0,0 +1,19 @@
+{
+ "devices":{
+ "netconf:mininet@10.1.9.24:1830":{
+ "basic":{
+ "driver":"ovs-netconf"
+ }
+ }
+ },
+ "apps":{
+ "org.onosproject.netconf":{
+ "devices":[{
+ "name":"mininet",
+ "password":"mininet",
+ "ip":"10.1.9.24",
+ "port":1830
+ }]
+ }
+ }
+} \ No newline at end of file
diff --git a/framework/src/onos/tools/test/topos/metro.py b/framework/src/onos/tools/test/topos/metro.py
new file mode 100755
index 00000000..1979b103
--- /dev/null
+++ b/framework/src/onos/tools/test/topos/metro.py
@@ -0,0 +1,217 @@
+#!/usr/bin/env python
+
+from mininet.net import Mininet
+from mininet.node import UserSwitch, DefaultController, RemoteController, Host
+from mininet.topo import Topo
+from mininet.log import setLogLevel, info
+from mininet.cli import CLI
+from mininet.link import OVSIntf
+
+from opticalUtils import LINCSwitch, LINCLink
+
+class Domain(object):
+ """
+ A container for switch, host, link, and controller information to be dumped
+ into the Mininet mid-level API.
+ """
+
+ def __init__ (self, did=0):
+ # each Domain has a numeric ID for sanity/convenience
+ self.__dId = did
+
+ # information about network elements - for calling the "mid-level" APIs
+ self.__ctrls = {}
+ self.__switches = {}
+ self.__hosts = {}
+ self.__links = {}
+ # maps of devices, hosts, and controller names to actual objects
+ self.__smap = {}
+ self.__hmap = {}
+ self.__cmap = {}
+
+ def addController(self, name, **args):
+ self.__ctrls[name] = args if args else {}
+ return name
+
+ def addSwitch(self, name, **args):
+ self.__switches[name] = args if args else {}
+ return name
+
+ def addHost(self, name, **args):
+ self.__hosts[name] = args if args else {}
+ return name
+
+ def addLink(self, src, dst, **args):
+ self.__links[(src, dst)] = args if args else {}
+ return (src, dst)
+
+ def getId( self):
+ return self.__dId
+
+ def getControllers(self, name=None):
+ return self.__cmap.values() if not name else self.__cmap.get(name)
+
+ def getSwitches(self, name=None):
+ return self.__smap.values() if not name else self.__smap.get(name)
+
+ def getHosts(self, name=None):
+ return self.__hmap.values() if not name else self.__hmap.get(name)
+
+ def injectInto(self, net):
+ """ Adds available topology info to a supplied Mininet object. """
+ # add switches, hosts, then links to mininet object
+ for sw, args in self.__switches.iteritems():
+ self.__smap[sw] = net.addSwitch(sw, **args)
+ for h, args in self.__hosts.iteritems():
+ self.__hmap[h] = net.addHost(h, **args)
+ for l, args in self.__links.iteritems():
+ src = self.__smap.get(l[0])
+ dst = self.__smap.get(l[1])
+ net.addLink(src if src else self.__hmap.get(l[0]),
+ dst if dst else self.__hmap.get(l[1]), **args)
+ # then controllers
+ for c, args in self.__ctrls.iteritems():
+ self.__cmap[c] = net.addController(c, **args)
+
+ def start(self):
+ """ starts the switches with the correct controller. """
+ map(lambda c: c.start(), self.__cmap.values())
+ map(lambda s: s.start(self.__cmap.values()), self.__smap.values())
+
+ def build(self, *args):
+ """ override for custom topology, similar to Topo """
+ pass
+
+
+class OpticalDomain(Domain):
+ """ An emulated optical metro core. It is Domain 0. """
+ def build(self):
+ oean = { "optical.regens": 0 }
+ for i in range (1,4):
+ self.addSwitch('OE%s' % i, dpid='0000ffffffffff0%s' % i, annotations=oean, cls=LINCSwitch)
+
+ an = { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }
+ self.addLink('OE1', 'OE2', port1=50, port2=30, annotations=an, cls=LINCLink)
+ self.addLink('OE2', 'OE3', port1=50, port2=30, annotations=an, cls=LINCLink)
+ self.addLink('OE3', 'OE1', port1=50, port2=30, annotations=an, cls=LINCLink)
+
+class FabricDomain(Domain):
+ """
+ An emulated CO fabric, which is basically a K(n,m) bipartite graph.
+
+ Each FabricDomain should be given a unique Domain ID (did) to ensure unique
+ names and addressing.
+ """
+ def __init__(self, did):
+ Domain.__init__(self, did)
+
+ def build(self, n=2, m=3, f=2):
+ # K(n,m) in bipartite graph
+ l_nsw=[]
+ l_msw=[]
+
+ # create n spine switches
+ for sw in range(n):
+ l_nsw.append(self.addSwitch('swn%s%s' % (self.getId(), sw+1), cls=UserSwitch))
+
+ # create connection point to optical core (a leaf switch)
+ tsw = self.addSwitch('swm%s01' % self.getId(), cls=UserSwitch)
+ self.addTether(tsw, 'sw000%s' % self.getId(), '0000ffffffff000%s' % self.getId())
+ l_msw.append(tsw)
+
+ # attach f hosts to last m-1 leaves
+ for sw in range(1, m):
+ msw = self.addSwitch('swm%s0%s' % (self.getId(), sw+1), cls=UserSwitch)
+ l_msw.append(msw)
+ for h in range(f):
+ host = self.addHost('h%s%s' % (self.getId(), sw * f+h+1), cls=IpHost,
+ ip='10.0.%s.%s/24' % ((self.getId()+sw+1), (f+1)),
+ gateway='10.0.%s.254' % (self.getId()+sw+1))
+ self.addLink(host, msw)
+ # link up spines and leaves
+ for nsw in l_nsw:
+ for msw in l_msw:
+ self.addLink(nsw, msw)
+
+ def addTether(self, name, tname, tdpid):
+ """
+ add an OVS with name 'tname' and dpid 'tdpid' for connecting fabric
+ domains to the core. name: the UserSwitch to connect the OVS to.
+ """
+ self.__tether = self.addSwitch(tname, dpid=tdpid)
+ self.addLink(tname, name, port1=1)
+
+ def getTether(self):
+ """ get connection point of this fabric to the core """
+ return self.__tether
+
+
+class IpHost(Host):
+ def __init__(self, name, gateway, *args, **kwargs):
+ super(IpHost, self).__init__(name, *args, **kwargs)
+ self.gateway = gateway
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+ mtu = "ifconfig "+self.name+"-eth0 mtu 1490"
+ self.cmd(mtu)
+ self.cmd('ip route add default via %s' % self.gateway)
+
+# fixed port numbers for attachment points (APs) between CORD and metro domains
+OVS_AP=2
+OE_AP=10
+
+def setup(argv):
+ domains = []
+ ctlsets = sys.argv[1:]
+
+ # the controllers for the optical domain
+ d0 = OpticalDomain()
+ domains.append(d0)
+ ctls = ctlsets[0].split(',')
+ for i in range (len(ctls)):
+ d0.addController('c0%s' % i, controller=RemoteController, ip=ctls[i])
+
+ # the fabric domains - position 1 for domain 1, 2 for 2 ...
+ for i in range (1,len(ctlsets)):
+ f = FabricDomain(i)
+ domains.append(f)
+ ctls = ctlsets[i].split(',')
+ for j in range (len(ctls)):
+ f.addController('c%s%s' % (i,j), controller=RemoteController, ip=ctls[j])
+
+ # make/setup Mininet object
+ net = Mininet()
+ for d in domains:
+ d.build()
+ d.injectInto(net)
+
+ # connect COs to core - sort of hard-wired at this moment
+ for i in range(1,len(domains)):
+ an = { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }
+ net.addLink(domains[i].getTether(), d0.getSwitches('OE%s' % i),
+ port1=OVS_AP, port2=OE_AP, speed=10000, annotations=an, cls=LINCLink)
+
+ # fire everything up
+ net.build()
+ map(lambda x: x.start(), domains)
+
+ # create a minimal copy of the network for configuring LINC.
+ cfgnet = Mininet()
+ cfgnet.switches = net.switches
+ cfgnet.links = net.links
+ cfgnet.controllers = d0.getControllers()
+ LINCSwitch.bootOE(cfgnet, d0.getSwitches())
+
+ CLI(net)
+ net.stop()
+ LINCSwitch.shutdownOE()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ import sys
+ if len(sys.argv) < 5:
+ print ("Usage: sudo -E ./metro.py ctl-set1 ... ctl-set4\n\n",
+ "Where ctl-set are comma-separated controller IP's")
+ else:
+ setup(sys.argv)