added containermanager shell feature 97/7097/6
authorjfokkan <jfokkan@inocybe.com>
Thu, 8 May 2014 15:32:42 +0000 (11:32 -0400)
committerEd Warnicke <eaw@cisco.com>
Mon, 16 Jun 2014 19:27:19 +0000 (14:27 -0500)
PatchSet5: Worked containermanager.shell into distro
           and pom files so that it both builds and
           is pulled into the old distribution/opendaylight.
           Also checked to make sure that it worked there.

PatchSet6: Fixed adding of new shell bundle to old
   distro

Change-Id: I7f4d86c9902a7f4a8f6bd4bae74ebe4a9634e3bc
Signed-off-by: Jonathan Fok kan <jfokkan@inocybe.com>
Signed-off-by: Ed Warnicke <eaw@cisco.com>
35 files changed:
features/base/pom.xml
features/base/src/main/resources/features.xml
features/controller/pom.xml [new file with mode: 0644]
features/controller/src/main/resources/features.xml [new file with mode: 0644]
opendaylight/commons/opendaylight/pom.xml
opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManagerShell.java [new file with mode: 0644]
opendaylight/containermanager/implementation/src/main/java/org/opendaylight/controller/containermanager/internal/Activator.java
opendaylight/containermanager/implementation/src/main/java/org/opendaylight/controller/containermanager/internal/ContainerManager.java
opendaylight/containermanager/shell/pom.xml [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainer.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainerEntry.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainerFlow.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetAuthorizedGroups.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetAuthorizedResources.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetResourcesForGroup.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetRoles.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetUserLevel.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetUserResources.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/CreateContainer.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Pfc.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psc.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psd.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psm.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psp.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainer.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainerEntry.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainerFlow.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/SaveConfig.java [new file with mode: 0644]
opendaylight/containermanager/shell/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]
opendaylight/containermanager/shell/src/test/java/org/opendaylight/controller/containermanager/shell/ContainerManagerShellTest.java [new file with mode: 0644]
opendaylight/distribution/opendaylight-karaf/pom.xml
opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/custom.properties
opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/startup.properties
opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/system.properties [new file with mode: 0644]
pom.xml

index d12432c..922b2d6 100644 (file)
@@ -8,7 +8,7 @@
     <relativePath>../../opendaylight/commons/opendaylight</relativePath>
   </parent>
   <artifactId>base-features</artifactId>
-  <packaging>kar</packaging>
+  <packaging>pom</packaging>
   <name>${project.artifactId}</name>
   <description>Base Features POM</description>
   <properties>
       </resource>
     </resources>
     <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-        <version>${karaf.version}</version>
-        <extensions>true</extensions>
-        <executions>
-          <execution>
-            <id>features-create-kar</id>
-            <goals>
-              <goal>features-create-kar</goal>
-            </goals>
-            <configuration>
-              <featuresFile>${project.build.directory}/classes/${features.file}</featuresFile>
-            </configuration>
-          </execution>
-        </executions>
-        <!-- There is no useful configuration for the kar mojo. The features-generate-descriptor mojo configuration may be useful -->
-      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
index 23051f5..5677ab6 100644 (file)
       <bundle start="true" start-level="35">mvn:orbit/org.apache.juli.extras/7.0.32.v201211081135</bundle>
       <bundle start="true" start-level="35">mvn:orbit/org.apache.tomcat.api/7.0.32.v201211081135</bundle>
       <bundle start="true" start-level="35">mvn:orbit/org.apache.tomcat.util/7.0.32.v201211201952</bundle>
-      <bundle start="true" start-level="35">wrap:mvn:virgomirror/org.eclipse.jdt.core.compiler.batch/3.8.0.I20120518-2145</bundle>
    </feature>
    <feature name="base-spring" description="Opendaylight Spring Support" version="${spring.version}">
       <bundle>mvn:org.ow2.asm/asm-all/${asm.version}</bundle>
diff --git a/features/controller/pom.xml b/features/controller/pom.xml
new file mode 100644 (file)
index 0000000..ddaf773
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.4.2-SNAPSHOT</version>
+    <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+  </parent>
+  <artifactId>controller-features</artifactId>
+  <packaging>pom</packaging>
+  <name>${project.artifactId}</name>
+  <description>Features POM</description>
+  <properties>
+    <features.file>features.xml</features.file>
+  </properties>
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>filter</id>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/${features.file}</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/features/controller/src/main/resources/features.xml b/features/controller/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..1ae210a
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<features name="controller-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+   <feature name="odl-hosttracker" description="Controller Service: Host Tracker">
+      <feature>odl-clustering</feature>
+      <feature>odl-managers</feature>
+      <feature>odl-sal</feature>
+      <bundle>mvn:org.opendaylight.controller/hosttracker/${hosttracker.api.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/hosttracker.implementation/${hosttracker.implementation.version}</bundle>
+   </feature>
+   <feature name="odl-sal" description="Service Abstraction Layer"
+      version="${sal.version}">
+      <feature>base-felix-dm</feature>
+      <bundle start="true" start-level="35">mvn:org.apache.commons/commons-lang3/${commons.lang.version}</bundle>
+      <bundle>mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version}</bundle>
+      <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager/${felix.dependencymanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal/${sal.version}</bundle>
+      <!-- The SAL Implementation doesn't follow API versioning, should be revisited in the bundle -->
+      <bundle>mvn:org.opendaylight.controller/sal.implementation/${sal.implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.networkconfiguration/${sal.networkconfiguration.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.networkconfiguration.implementation/${sal.networkconfiguration.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.connection/${sal.connection.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.connection.implementation/${sal.connection.version}</bundle>
+   </feature>
+   <feature name="odl-clustering" description="Controller Service: Clustering">
+      <feature>transaction</feature>
+      <feature>base-felix-dm</feature>
+      <feature>base-eclipselink-persistence</feature>
+      <feature>odl-sal</feature>
+      <bundle>mvn:org.opendaylight.controller/clustering.services/${clustering.services.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/clustering.services-implementation/${clustering.services_implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/clustering.stub/${clustering.stub.version}</bundle>
+   </feature>
+   <feature name="odl-legacy-configuration">
+      <feature>odl-sal</feature>
+      <bundle>mvn:org.opendaylight.controller/configuration/${configuration.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/configuration.implementation/${configuration.implementation.version}</bundle>
+   </feature>
+   <feature name="odl-configuration" description="Controller Service: Configuration">
+      <!-- org.opendaylight.controller.config.yangjmxgenerator is missing -->
+      <bundle>mvn:org.opendaylight.controller/config-api/${config.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/config-manager/${config.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/config-netconf-connector/${netconf.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/config-persister-api/${config.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/config-persister-directory-xml-adapter/${config.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/config-persister-file-xml-adapter/${config.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/config-persister-impl/${netconf.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/yang-jmx-generator/${yang-jmx-generator.version}</bundle>
+   </feature>
+   <feature name="odl-managers" description="Big boss">
+      <feature>odl-legacy-configuration</feature>
+      <feature>base-spring-security</feature>
+      <feature>base-felix-dm</feature>
+      <feature>odl-clustering</feature>
+      <bundle>mvn:org.opendaylight.controller.thirdparty/net.sf.jung2/2.0.1</bundle>
+      <bundle>mvn:org.opendaylight.controller/appauth/${appauth.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/hosttracker/${hosttracker.api.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/hosttracker.implementation/${hosttracker.implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/switchmanager/${switchmanager.api.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/switchmanager.implementation/${switchmanager.implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/statisticsmanager/${statisticsmanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/statisticsmanager.implementation/${statisticsmanager.implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/forwardingrulesmanager/${forwardingrulesmanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/forwardingrulesmanager.implementation/${forwardingrulesmanager.implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/usermanager/${usermanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/usermanager.implementation/${usermanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/containermanager/${containermanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/containermanager.implementation/${containermanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/topologymanager/${topologymanager.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/forwarding.staticrouting</bundle>
+      <bundle>mvn:org.opendaylight.controller/routing.dijkstra_implementation</bundle>
+      <bundle>mvn:org.opendaylight.controller/connectionmanager</bundle>
+      <bundle>mvn:org.opendaylight.controller/connectionmanager.implementation</bundle>
+   </feature>
+</features>
index c3c8168..59fc760 100644 (file)
   <properties>
     <aopalliance.version>1.0.0</aopalliance.version>
     <appauth.version>0.4.2-SNAPSHOT</appauth.version>
+    <archetype-app-northbound>0.0.1-SNAPSHOT</archetype-app-northbound>
     <aries.util.version>1.1.0</aries.util.version>
     <!-- Controller Modules Versions -->
     <arphandler.version>0.5.2-SNAPSHOT</arphandler.version>
+    <arphandler.version>0.5.2-SNAPSHOT</arphandler.version>
     <asm.version>4.1</asm.version>
     <!-- Plugin Versions -->
     <bouncycastle.version>1.50</bouncycastle.version>
     <bundle.plugin.version>2.4.0</bundle.plugin.version>
+    <bundlescanner.api.version>0.4.2-SNAPSHOT</bundlescanner.api.version>
+    <bundlescanner.implementation.version>0.4.2-SNAPSHOT</bundlescanner.implementation.version>
     <bundlescanner.version>0.4.2-SNAPSHOT</bundlescanner.version>
     <checkstyle.version>2.10</checkstyle.version>
     <clustering.services.version>0.5.1-SNAPSHOT</clustering.services.version>
     <clustering.stub.version>0.4.2-SNAPSHOT</clustering.stub.version>
     <clustering.test.version>0.4.2-SNAPSHOT</clustering.test.version>
     <commmons.northbound.version>0.4.2-SNAPSHOT</commmons.northbound.version>
+    <commons.checkstyle.version>0.0.3-SNAPSHOT</commons.checkstyle.version>
     <!-- Third Party Versions -->
     <commons.codec.version>1.7</commons.codec.version>
     <commons.fileupload.version>1.2.2</commons.fileupload.version>
     <commons.httpclient.version>0.1.2-SNAPSHOT</commons.httpclient.version>
     <commons.io.version>2.4</commons.io.version>
     <commons.lang.version>3.1</commons.lang.version>
+    <commons.logback_settings.version>0.0.2-SNAPSHOT</commons.logback_settings.version>
     <commons.net.version>3.0.1</commons.net.version>
+    <commons.opendaylight.commons.httpclient>0.1.2-SNAPSHOT</commons.opendaylight.commons.httpclient>
+    <commons.opendaylight.concepts.version>0.5.2-SNAPSHOT</commons.opendaylight.concepts.version>
+    <commons.opendaylight.version>1.4.2-SNAPSHOT</commons.opendaylight.version>
+    <commons.parent.version>1.0.2-SNAPSHOT</commons.parent.version>
     <compiler.version>2.3.2</compiler.version>
     <concepts.version>0.5.2-SNAPSHOT</concepts.version>
     <config.version>0.2.5-SNAPSHOT</config.version>
     <connectionmanager.version>0.1.2-SNAPSHOT</connectionmanager.version>
     <containermanager.it.version>0.5.2-SNAPSHOT</containermanager.it.version>
     <containermanager.northbound.version>0.4.2-SNAPSHOT</containermanager.northbound.version>
+    <containermanager.shell.version>0.5.2-SNAPSHOT</containermanager.shell.version>
     <containermanager.version>0.5.2-SNAPSHOT</containermanager.version>
     <controllermanager.northbound.version>0.0.2-SNAPSHOT</controllermanager.northbound.version>
     <corsfilter.version>7.0.42</corsfilter.version>
     <ctrie.version>0.2.0</ctrie.version>
     <devices.web.version>0.4.2-SNAPSHOT</devices.web.version>
+    <dummy-console.version>1.1.0-SNAPSHOT</dummy-console.version>
     <eclipse.persistence.version>2.5.0</eclipse.persistence.version>
     <!-- enforcer version -->
     <enforcer.version>1.3.1</enforcer.version>
@@ -79,6 +91,8 @@
     <hosttracker.implementation.version>0.5.2-SNAPSHOT</hosttracker.implementation.version>
     <hosttracker.northbound.version>0.4.2-SNAPSHOT</hosttracker.northbound.version>
     <hosttracker_new.api.version>0.4.2-SNAPSHOT</hosttracker_new.api.version>
+    <hosttracker_new.implementation.version>0.4.2-SNAPSHOT</hosttracker_new.implementation.version>
+    <httpservice-bridge.northbound.version>0.0.2-SNAPSHOT</httpservice-bridge.northbound.version>
     <ietf-inet-types.version>2010.09.24.4-SNAPSHOT</ietf-inet-types.version>
     <ietf-restconf.version>2013.10.19.1-SNAPSHOT</ietf-restconf.version>
     <ietf-topology.version>2013.10.21.2-SNAPSHOT</ietf-topology.version>
     <jersey2.version>2.8</jersey2.version>
     <jettison.version>1.3.3</jettison.version>
     <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>
+    <jolokia-bridge.version>0.0.2-SNAPSHOT</jolokia-bridge.version>
     <jolokia.version>1.1.4</jolokia.version>
     <jsr305.api.version>2.0.1</jsr305.api.version>
     <jsr311.api.version>1.1.1</jsr311.api.version>
     <jsr311.v2.api.version>2.0</jsr311.v2.api.version>
     <junit.version>4.8.1</junit.version>
     <karaf.branding.version>1.0.0-SNAPSHOT</karaf.branding.version>
+    <karaf.shell.version>3.0.0</karaf.shell.version>
     <karaf.version>3.0.1</karaf.version>
     <logback.version>1.0.9</logback.version>
     <logging.bridge.version>0.4.2-SNAPSHOT</logging.bridge.version>
     <networkconfig.neutron.version>0.4.2-SNAPSHOT</networkconfig.neutron.version>
     <!-- ODL repository / plugin repository -->
     <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+    <northbound.commons.version>0.4.2-SNAPSHOT</northbound.commons.version>
+    <northbound.hosttracker.version>1.4.2-SNAPSHOT</northbound.hosttracker.version>
+    <northbound.jolokia.version>1.4.2-SNAPSHOT</northbound.jolokia.version>
     <opendaylight-l2-types.version>2013.08.27.4-SNAPSHOT</opendaylight-l2-types.version>
     <org.json.version>20080701</org.json.version>
     <osgi-brandfragment.web.version>0.0.2-SNAPSHOT</osgi-brandfragment.web.version>
     <xtend.dstdir>src/main/xtend-gen</xtend.dstdir>
     <xtend.version>2.4.3</xtend.version>
     <yang-ext.version>2013.09.07.4-SNAPSHOT</yang-ext.version>
+    <yang-jmx-generator.version>1.0.0-SNAPSHOT</yang-jmx-generator.version>
     <yangtools.version>0.6.2-SNAPSHOT</yangtools.version>
   </properties>
 
         <artifactId>containermanager.northbound</artifactId>
         <version>${containermanager.northbound.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager.shell</artifactId>
+        <version>${containermanager.shell.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>controllermanager.northbound</artifactId>
diff --git a/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManagerShell.java b/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManagerShell.java
new file mode 100644 (file)
index 0000000..2024b18
--- /dev/null
@@ -0,0 +1,25 @@
+package org.opendaylight.controller.containermanager;
+
+import java.util.List;
+
+public interface IContainerManagerShell {
+    public List<String> psc();
+    public List<String> pfc();
+    public List<String> psd();
+    public List<String> psp();
+    public List<String> psm();
+    public List<String> addContainer(String arg1, String arg2);
+    public List<String> createContainer(String arg1, String arg2);
+    public List<String> removeContainerShell(String arg1);
+    public List<String> addContainerEntry(String arg1, String arg2, String arg3);
+    public List<String> removeContainerEntry(String arg1, String arg2, String arg3);
+    public List<String> addContainerFlow(String arg1, String arg2, String arg3);
+    public List<String> removeContainerFlow(String arg1, String arg2);
+    public List<String> containermgrGetRoles();
+    public List<String> containermgrGetAuthorizedGroups(String arg1);
+    public List<String> containermgrGetAuthorizedResources(String arg1);
+    public List<String> containermgrGetResourcesForGroup(String arg1);
+    public List<String> containermgrGetUserLevel(String arg1);
+    public List<String> containermgrGetUserResources(String arg1);
+    public List<String> saveConfig();
+}
\ No newline at end of file
index 616a0f2..61c8ab6 100644 (file)
 package org.opendaylight.controller.containermanager.internal;
 
 import org.eclipse.osgi.framework.console.CommandProvider;
+
 import java.util.Dictionary;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.Hashtable;
+
 import org.opendaylight.controller.containermanager.IContainerManager;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
 import org.apache.felix.dm.Component;
 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
@@ -124,7 +127,8 @@ public class Activator extends ComponentActivatorAbstractBase {
                             CommandProvider.class.getName(),
                             IContainerInternal.class.getName(),
                             IContainerAuthorization.class.getName(),
-                            ICacheUpdateAware.class.getName()}, props);
+                            ICacheUpdateAware.class.getName(),
+                            IContainerManagerShell.class.getName()}, props);
 
             c.add(createServiceDependency()
                     .setService(IClusterGlobalServices.class)
index 0fee183..98378e8 100644 (file)
@@ -44,6 +44,7 @@ import org.opendaylight.controller.containermanager.ContainerFlowChangeEvent;
 import org.opendaylight.controller.containermanager.ContainerFlowConfig;
 import org.opendaylight.controller.containermanager.IContainerAuthorization;
 import org.opendaylight.controller.containermanager.IContainerManager;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
 import org.opendaylight.controller.containermanager.NodeConnectorsChangeEvent;
 import org.opendaylight.controller.sal.authorization.AppRoleLevel;
 import org.opendaylight.controller.sal.authorization.Privilege;
@@ -71,7 +72,7 @@ import org.slf4j.LoggerFactory;
 
 public class ContainerManager extends Authorization<String> implements IContainerManager, IObjectReader,
         CommandProvider, ICacheUpdateAware<String, Object>, IContainerInternal, IContainerAuthorization,
-        IConfigurationAware {
+        IConfigurationAware, IContainerManagerShell {
     private static final Logger logger = LoggerFactory.getLogger(ContainerManager.class);
     private static String CONTAINERS_FILE_NAME = "containers.conf";
     private static final String allContainersGroup = "allContainers";
@@ -1619,4 +1620,286 @@ public class ContainerManager extends Authorization<String> implements IContaine
     public boolean inContainerMode() {
         return this.containerConfigs.size() > 0;
     }
+
+    public List<String> psc() {
+        List<String> result = new ArrayList<String>();
+        for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) {
+            ContainerConfig sc = entry.getValue();
+            result.add(String.format("%s: %s", sc.getContainerName(), sc.toString()));
+        }
+        result.add("Total number of containers: " + containerConfigs.entrySet().size());
+        return result;
+    }
+
+    public List<String> pfc() {
+        List<String> result = new ArrayList<String>();
+        for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) {
+            ContainerConfig sc = entry.getValue();
+            result.add(String.format("%s: %s", sc.getContainerName(), sc.getContainerFlowConfigs()));
+        }
+        return result;
+    }
+
+    public List<String> psd() {
+        List<String> result = new ArrayList<String>();
+        for (String containerName : containerData.keySet()) {
+            ContainerData sd = containerData.get(containerName);
+            for (Node sid : sd.getSwPorts().keySet()) {
+                Set<NodeConnector> s = sd.getSwPorts().get(sid);
+                result.add("\t" + sid + " : " + s);
+            }
+
+            for (ContainerFlow s : sd.getContainerFlowSpecs()) {
+                result.add("\t" + s.toString());
+            }
+        }
+        return result;
+    }
+
+    public List<String> psp() {
+        List<String> result = new ArrayList<String>();
+        for (NodeConnector sp : nodeConnectorToContainers.keySet()) {
+            result.add(nodeConnectorToContainers.get(sp).toString());
+        }
+        return result;
+    }
+
+    public List<String> psm() {
+        List<String> result = new ArrayList<String>();
+        for (Node sp : nodeToContainers.keySet()) {
+            result.add(nodeToContainers.get(sp).toString());
+        }
+        return result;
+    }
+
+    public List<String> addContainer(String arg1, String arg2) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        String staticVlan = arg2;
+        ContainerConfig containerConfig = new ContainerConfig(containerName, staticVlan, null, null);
+        result.add((this.addRemoveContainer(containerConfig, false)).toString());
+        return result;
+    }
+
+    public List<String> createContainer(String arg1, String arg2) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        String staticVlan = arg2;
+        if (staticVlan == null) {
+            result.add("Static Vlan not specified");
+            return result;
+        }
+        List<String> ports = new ArrayList<String>();
+        for (long l = 1L; l < 10L; l++) {
+            ports.add(NodeConnectorCreator.createOFNodeConnector((short) 1, NodeCreator.createOFNode(l)).toString());
+        }
+        List<ContainerFlowConfig> cFlowList = new ArrayList<ContainerFlowConfig>();
+        cFlowList.add(this.createSampleContainerFlowConfig("tcp", true));
+        ContainerConfig containerConfig = new ContainerConfig(containerName, staticVlan, ports, cFlowList);
+        result.add((this.addRemoveContainer(containerConfig, false)).toString());
+        return result;
+    }
+
+    public List<String> removeContainerShell(String arg1) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        ContainerConfig containerConfig = new ContainerConfig(containerName, "", null, null);
+        result.add((this.addRemoveContainer(containerConfig, true)).toString());
+        return result;
+    }
+
+    public List<String> addContainerEntry(String arg1, String arg2, String arg3) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        String nodeId = arg2;
+        if (nodeId == null) {
+            result.add("Node Id not specified");
+            return result;
+        }
+        String portId = arg3;
+        if (portId == null) {
+            result.add("Port not specified");
+            return result;
+        }
+        Node node = NodeCreator.createOFNode(Long.valueOf(nodeId));
+        Short port = Short.valueOf(portId);
+        NodeConnector nc = NodeConnectorCreator.createOFNodeConnector(port, node);
+        List<String> portList = new ArrayList<String>(1);
+        portList.add(nc.toString());
+        result.add((this.addRemoveContainerEntries(containerName, portList, false)).toString());
+        return result;
+    }
+
+    public List<String> removeContainerEntry(String arg1, String arg2, String arg3) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        String nodeId = arg2;
+        if (nodeId == null) {
+            result.add("Node Id not specified");
+            return result;
+        }
+        String portId = arg3;
+        if (portId == null) {
+            result.add("Port not specified");
+            return result;
+        }
+        Node node = NodeCreator.createOFNode(Long.valueOf(nodeId));
+        Short port = Short.valueOf(portId);
+        NodeConnector nc = NodeConnectorCreator.createOFNodeConnector(port, node);
+        List<String> portList = new ArrayList<String>(1);
+        portList.add(nc.toString());
+        result.add((this.addRemoveContainerEntries(containerName, portList, true)).toString());
+        return result;
+    }
+    public List<String> addContainerFlow(String arg1, String arg2, String arg3) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        String cflowName = arg2;
+        if (cflowName == null) {
+            result.add("cflowName not specified");
+            return result;
+        }
+        String unidirectional = arg3;
+        boolean boolUnidirectional = Boolean.parseBoolean(unidirectional);
+        List<ContainerFlowConfig> list = new ArrayList<ContainerFlowConfig>();
+        list.add(createSampleContainerFlowConfig(cflowName, boolUnidirectional));
+        result.add((this.addRemoveContainerFlow(containerName, list, false)).toString());
+        return result;
+    }
+
+    public List<String> removeContainerFlow(String arg1, String arg2) {
+        List<String> result = new ArrayList<String>();
+        String containerName = arg1;
+        if (containerName == null) {
+            result.add("Container Name not specified");
+            return result;
+        }
+        String cflowName = arg2;
+        if (cflowName == null) {
+            result.add("cflowName not specified");
+            return result;
+        }
+        Set<String> set = new HashSet<String>(1);
+        set.add(cflowName);
+        result.add((this.removeContainerFlows(containerName, set)).toString());
+        return result;
+    }
+
+    public List<String> containermgrGetRoles() {
+        List<String> result = new ArrayList<String>();
+        result.add("Configured roles for Container Mgr:");
+        List<String> list = this.getRoles();
+        for (String role : list) {
+            result.add(role + "\t" + roles.get(role));
+        }
+        return result;
+    }
+
+    public List<String> containermgrGetAuthorizedGroups(String arg1) {
+        List<String> result = new ArrayList<String>();
+        String roleName = arg1;
+        if (roleName == null || roleName.trim().isEmpty()) {
+            result.add("Invalid argument");
+            result.add("mmGetAuthorizedGroups <role_name>");
+            return result;
+        }
+        result.add("Resource Groups associated to role " + roleName + ":");
+        List<ResourceGroup> list = this.getAuthorizedGroups(roleName);
+        for (ResourceGroup group : list) {
+            result.add(group.toString());
+        }
+        return result;
+    }
+    public List<String> containermgrGetAuthorizedResources(String arg1) {
+        List<String> result = new ArrayList<String>();
+        String roleName = arg1;
+        if (roleName == null || roleName.trim().isEmpty()) {
+            result.add("Invalid argument");
+            result.add("mmGetAuthorizedResources <role_name>");
+            return result;
+        }
+        result.add("Resource associated to role " + roleName + ":");
+        List<Resource> list = this.getAuthorizedResources(roleName);
+        for (Resource resource : list) {
+            result.add(resource.toString());
+        }
+        return result;
+    }
+    public List<String> containermgrGetResourcesForGroup(String arg1) {
+        List<String> result = new ArrayList<String>();
+        String groupName = arg1;
+        if (groupName == null || groupName.trim().isEmpty()) {
+            result.add("Invalid argument");
+            result.add("containermgrResourcesForGroup <group_name>");
+            return result;
+        }
+        result.add("Group " + groupName + " contains the following resources:");
+        List<Object> resources = this.getResources(groupName);
+        for (Object resource : resources) {
+            result.add(resource.toString());
+        }
+        return result;
+    }
+    public List<String> containermgrGetUserLevel(String arg1) {
+        List<String> result = new ArrayList<String>();
+        String userName = arg1;
+        if (userName == null || userName.trim().isEmpty()) {
+            result.add("Invalid argument");
+            result.add("containermgrGetUserLevel <user_name>");
+            return result;
+        }
+        result.add("User " + userName + " has level: " + this.getUserLevel(userName));
+        return result;
+    }
+    public List<String> containermgrGetUserResources(String arg1) {
+        List<String> result = new ArrayList<String>();
+        String userName = arg1;
+        if (userName == null || userName.trim().isEmpty()) {
+            result.add("Invalid argument");
+            result.add("containermgrGetUserResources <user_name>");
+            return result;
+        }
+        result.add("User " + userName + " owns the following resources: ");
+        Set<Resource> resources = this.getAllResourcesforUser(userName);
+        for (Resource resource : resources) {
+            result.add(resource.toString());
+        }
+        return result;
+    }
+    public List<String> saveConfig() {
+        List<String> result = new ArrayList<String>();
+        Status status = new Status(StatusCode.NOSERVICE, "Configuration service not reachable");
+
+        IConfigurationService configService = (IConfigurationService) ServiceHelper.getGlobalInstance(
+                IConfigurationService.class, this);
+        if (configService != null) {
+            status = configService.saveConfigurations();
+        }
+        result.add(status.toString());
+        return result;
+    }
 }
diff --git a/opendaylight/containermanager/shell/pom.xml b/opendaylight/containermanager/shell/pom.xml
new file mode 100644 (file)
index 0000000..1eedd4b
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.4.2-SNAPSHOT</version>
+    <relativePath>../../commons/opendaylight</relativePath>
+  </parent>
+  <artifactId>containermanager.shell</artifactId>
+  <version>${containermanager.shell.version}</version>
+  <packaging>bundle</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>${karaf.shell.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+      <version>${containermanager.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${bundle.plugin.version}</version>
+        <configuration>
+          <instructions>
+            <Import-Package>org.apache.felix.service.command,
+              org.apache.karaf.shell.commands,
+              org.apache.karaf.shell.console,
+              *</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainer.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainer.java
new file mode 100644 (file)
index 0000000..e87682e
--- /dev/null
@@ -0,0 +1,29 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "addcontainer", description="Add Container")
+public class AddContainer extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Argument(index=1, name="staticVlan", description="staticVlan", required=true, multiValued=false)
+    String staticVlan = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.addContainer(containerName, staticVlan)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainerEntry.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainerEntry.java
new file mode 100644 (file)
index 0000000..b7ee4bd
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "AddContainerEntry", description="add container entry")
+public class AddContainerEntry extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Argument(index=1, name="nodeId", description="node ID", required=true, multiValued=false)
+    String nodeId = null;
+
+    @Argument(index=2, name="portId", description="portId", required=true, multiValued=false)
+    String portId = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.addContainerEntry(containerName, nodeId, portId)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainerFlow.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/AddContainerFlow.java
new file mode 100644 (file)
index 0000000..03ed94d
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "addContainerFlow", description="adds container flow")
+public class AddContainerFlow extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Argument(index=1, name="cflowName", description="c Flow name", required=true, multiValued=false)
+    String cflowName = null;
+
+    @Argument(index=2, name="unidirectional", description="unidirectional", required=true, multiValued=false)
+    String unidirectional = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.addContainerFlow(containerName, cflowName, unidirectional)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetAuthorizedGroups.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetAuthorizedGroups.java
new file mode 100644 (file)
index 0000000..f78b856
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "containermgrGetAuthorizedGroups", description="Get authorized groups")
+public class ContainermgrGetAuthorizedGroups extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="roleName", description="role name", required=true, multiValued=false)
+    String roleName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.containermgrGetAuthorizedGroups(roleName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetAuthorizedResources.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetAuthorizedResources.java
new file mode 100644 (file)
index 0000000..1ac50fa
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "containermgrGetAuthorizedResources", description="Get authorized resources")
+public class ContainermgrGetAuthorizedResources extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="roleName", description="role name", required=true, multiValued=false)
+    String roleName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.containermgrGetAuthorizedResources(roleName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetResourcesForGroup.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetResourcesForGroup.java
new file mode 100644 (file)
index 0000000..bbccb65
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "containermgrGetResourcesForGroup", description="Get resources for group")
+public class ContainermgrGetResourcesForGroup extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="groupName", description="group name", required=true, multiValued=false)
+    String groupName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.containermgrGetResourcesForGroup(groupName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetRoles.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetRoles.java
new file mode 100644 (file)
index 0000000..38fdb27
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "containermgrGetRoles", description="Get container mgr roles")
+public class ContainermgrGetRoles extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.containermgrGetRoles()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetUserLevel.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetUserLevel.java
new file mode 100644 (file)
index 0000000..9ee607a
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "containermgrGetUserLevel", description="Get user level")
+public class ContainermgrGetUserLevel extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="userName", description="user name", required=true, multiValued=false)
+    String userName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.containermgrGetUserLevel(userName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetUserResources.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/ContainermgrGetUserResources.java
new file mode 100644 (file)
index 0000000..6a281bd
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "containermgrGetUserResources", description="Get user resources")
+public class ContainermgrGetUserResources extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="userName", description="user name", required=true, multiValued=false)
+    String userName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.containermgrGetUserResources(userName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/CreateContainer.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/CreateContainer.java
new file mode 100644 (file)
index 0000000..ef51563
--- /dev/null
@@ -0,0 +1,29 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "createcontainer", description="create container")
+public class CreateContainer extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Argument(index=1, name="staticVlan", description="staticVlan", required=true, multiValued=false)
+    String staticVlan = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.createContainer(containerName, staticVlan)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Pfc.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Pfc.java
new file mode 100644 (file)
index 0000000..62b4c9a
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "pfc", description="Display pfc")
+public class Pfc extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.pfc()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psc.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psc.java
new file mode 100644 (file)
index 0000000..83e6496
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "psc", description="Display ")
+public class Psc extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.psc()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psd.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psd.java
new file mode 100644 (file)
index 0000000..ff8a024
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "psd", description="Display psd")
+public class Psd extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.psd()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psm.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psm.java
new file mode 100644 (file)
index 0000000..a7c3549
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "psm", description="Display psm")
+public class Psm extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.psm()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psp.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/Psp.java
new file mode 100644 (file)
index 0000000..d221c83
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "psp", description="Display psp")
+public class Psp extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.psp()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainer.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainer.java
new file mode 100644 (file)
index 0000000..997ef67
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "removecontainer", description="remove container")
+public class RemoveContainer extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.removeContainerShell(containerName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainerEntry.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainerEntry.java
new file mode 100644 (file)
index 0000000..9413842
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "removeContainerEntry", description="remove container entry")
+public class RemoveContainerEntry extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Argument(index=1, name="nodeId", description="node ID", required=true, multiValued=false)
+    String nodeId = null;
+
+    @Argument(index=2, name="portId", description="portId", required=true, multiValued=false)
+    String portId = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.removeContainerEntry(containerName, nodeId, portId)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainerFlow.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/RemoveContainerFlow.java
new file mode 100644 (file)
index 0000000..94cbb19
--- /dev/null
@@ -0,0 +1,29 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "removeContainerFlow", description="removes container flow")
+public class RemoveContainerFlow extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Argument(index=0, name="containerName", description="container name", required=true, multiValued=false)
+    String containerName = null;
+
+    @Argument(index=1, name="cflowName", description="c Flow name", required=true, multiValued=false)
+    String cflowName = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.removeContainerFlow(containerName, cflowName)) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/SaveConfig.java b/opendaylight/containermanager/shell/src/main/java/org/opendaylight/controller/containermanager/shell/SaveConfig.java
new file mode 100644 (file)
index 0000000..b96f769
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+@Command(scope = "containermanager", name = "saveConfig", description="Save config")
+public class SaveConfig extends OsgiCommandSupport{
+    private IContainerManagerShell containerManager;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        for(String p : containerManager.saveConfig()) {
+            System.out.println(p);
+        }
+        return null;
+    }
+
+    public void setContainerManager(IContainerManagerShell containerManager){
+        this.containerManager = containerManager;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/containermanager/shell/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/opendaylight/containermanager/shell/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..e7e01f8
--- /dev/null
@@ -0,0 +1,123 @@
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <reference id="containerManagerRef" interface="org.opendaylight.controller.containermanager.IContainerManagerShell"/>
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.AddContainer">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.AddContainerEntry">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.AddContainerFlow">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.ContainermgrGetAuthorizedGroups">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.ContainermgrGetAuthorizedResources">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.ContainermgrGetResourcesForGroup">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.ContainermgrGetRoles">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.ContainermgrGetUserLevel">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.ContainermgrGetUserResources">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.CreateContainer">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.Pfc">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.Psc">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.Psd">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.Psm">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.Psp">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.RemoveContainer">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.RemoveContainerEntry">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.RemoveContainerFlow">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+        <command>
+        <action class="org.opendaylight.controller.containermanager.shell.SaveConfig">
+            <property name="containerManager" ref="containerManagerRef"/>
+            </action>
+        </command>
+
+    </command-bundle>
+
+
+</blueprint>
diff --git a/opendaylight/containermanager/shell/src/test/java/org/opendaylight/controller/containermanager/shell/ContainerManagerShellTest.java b/opendaylight/containermanager/shell/src/test/java/org/opendaylight/controller/containermanager/shell/ContainerManagerShellTest.java
new file mode 100644 (file)
index 0000000..f11d1da
--- /dev/null
@@ -0,0 +1,368 @@
+package org.opendaylight.controller.containermanager.shell;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.lang.reflect.Field;
+
+import org.junit.Assert;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import org.opendaylight.controller.containermanager.IContainerManagerShell;
+
+
+public class ContainerManagerShellTest {
+    private IContainerManagerShell containerManager;
+
+    @Test
+    public void testAddContainer() throws Exception {
+        String containerName = "test", staticVlan = "1234";
+        AddContainer addConTest = new AddContainer();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        List<String> result2 = new ArrayList<String>(Arrays.asList("Container Name not specified"));
+        when(containerManager.addContainer(containerName, staticVlan)).thenReturn(result);
+        when(containerManager.addContainer(null, null)).thenReturn(result2);
+
+        Field cNField = addConTest.getClass().getDeclaredField("containerName");
+        cNField.setAccessible(true);
+        Field sVField = addConTest.getClass().getDeclaredField("staticVlan");
+        sVField.setAccessible(true);
+
+        cNField.set(addConTest, "test");
+        sVField.set(addConTest, "1234");
+
+        addConTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        addConTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+        baos.reset();
+
+        cNField.set(addConTest, null);
+        sVField.set(addConTest, null);
+        addConTest.doExecute();
+        Assert.assertEquals("Container Name not specified\n", baos.toString());
+    }
+
+    @Test
+    public void testAddContainerEntry() throws Exception {
+        String containerName = "test", nodeId = "1234", portId = "5678";
+        AddContainerEntry addConEntTest = new AddContainerEntry();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.addContainerEntry(containerName, nodeId, portId)).thenReturn(result);
+
+        Field cNField = addConEntTest.getClass().getDeclaredField("containerName");
+        cNField.setAccessible(true);
+        Field nIField = addConEntTest.getClass().getDeclaredField("nodeId");
+        nIField.setAccessible(true);
+        Field pIField = addConEntTest.getClass().getDeclaredField("portId");
+        pIField.setAccessible(true);
+
+        cNField.set(addConEntTest, "test");
+        nIField.set(addConEntTest, "1234");
+        pIField.set(addConEntTest, "5678");
+
+        addConEntTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        addConEntTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testAddContainerFlow() throws Exception {
+        String containerName = "test", cflowName = "1234", unidirectional = "5678";
+        AddContainerFlow addConFlowTest = new AddContainerFlow();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.addContainerFlow(containerName, cflowName, unidirectional)).thenReturn(result);
+
+        Field cNField = addConFlowTest.getClass().getDeclaredField("containerName");
+        cNField.setAccessible(true);
+        Field cfField = addConFlowTest.getClass().getDeclaredField("cflowName");
+        cfField.setAccessible(true);
+        Field unField = addConFlowTest.getClass().getDeclaredField("unidirectional");
+        unField.setAccessible(true);
+
+        cNField.set(addConFlowTest, "test");
+        cfField.set(addConFlowTest, "1234");
+        unField.set(addConFlowTest, "5678");
+
+        addConFlowTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        addConFlowTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testContainermgrGetAuthorizedGroups() throws Exception {
+        String roleName = "test";
+        ContainermgrGetAuthorizedGroups contmgrGTest = new ContainermgrGetAuthorizedGroups();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.containermgrGetAuthorizedGroups(roleName)).thenReturn(result);
+
+        Field rNField = contmgrGTest.getClass().getDeclaredField("roleName");
+        rNField.setAccessible(true);
+
+        rNField.set(contmgrGTest, "test");
+
+        contmgrGTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        contmgrGTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testContainermgrGetAuthorizedResources() throws Exception {
+        String roleName = "test";
+        ContainermgrGetAuthorizedResources contmgrRTest = new ContainermgrGetAuthorizedResources();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.containermgrGetAuthorizedResources(roleName)).thenReturn(result);
+
+        Field rNField = contmgrRTest.getClass().getDeclaredField("roleName");
+        rNField.setAccessible(true);
+
+        rNField.set(contmgrRTest, "test");
+
+        contmgrRTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        contmgrRTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testContainermgrGetResourcesForGroup() throws Exception {
+        String groupName = "test";
+        ContainermgrGetResourcesForGroup contmgrRTest = new ContainermgrGetResourcesForGroup();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.containermgrGetResourcesForGroup(groupName)).thenReturn(result);
+
+        Field gNField = contmgrRTest.getClass().getDeclaredField("groupName");
+        gNField.setAccessible(true);
+
+        gNField.set(contmgrRTest, groupName);
+
+        contmgrRTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        contmgrRTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testContainermgrGetRoles() throws Exception {
+        ContainermgrGetRoles contmgrRTest = new ContainermgrGetRoles();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.containermgrGetRoles()).thenReturn(result);
+
+        contmgrRTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        contmgrRTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testContainermgrGetUserLevel() throws Exception {
+        String userName = "test";
+        ContainermgrGetUserLevel contmgrUTest = new ContainermgrGetUserLevel();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.containermgrGetUserLevel(userName)).thenReturn(result);
+
+        Field gNField = contmgrUTest.getClass().getDeclaredField("userName");
+        gNField.setAccessible(true);
+
+        gNField.set(contmgrUTest, userName);
+
+        contmgrUTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        contmgrUTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testContainermgrGetUserResources() throws Exception {
+        String userName = "test";
+        ContainermgrGetUserResources contmgrUTest = new ContainermgrGetUserResources();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.containermgrGetUserResources(userName)).thenReturn(result);
+
+        Field gNField = contmgrUTest.getClass().getDeclaredField("userName");
+        gNField.setAccessible(true);
+
+        gNField.set(contmgrUTest, userName);
+
+        contmgrUTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        contmgrUTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testPfc() throws Exception {
+        Pfc pfc = new Pfc();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.pfc()).thenReturn(result);
+
+        pfc.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        pfc.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testPsc() throws Exception {
+        Psc psc = new Psc();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.psc()).thenReturn(result);
+
+        psc.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        psc.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testPsd() throws Exception {
+        Psd psd = new Psd();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.psd()).thenReturn(result);
+
+        psd.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        psd.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testPsm() throws Exception {
+        Psm psm = new Psm();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.psm()).thenReturn(result);
+
+        psm.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        psm.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testPsp() throws Exception {
+        Psp psp = new Psp();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.psp()).thenReturn(result);
+
+        psp.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        psp.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testRemoveContainer() throws Exception {
+        String containerName = "test";
+        RemoveContainer remConTest = new RemoveContainer();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.removeContainerShell(containerName)).thenReturn(result);
+
+        Field cNField = remConTest.getClass().getDeclaredField("containerName");
+        cNField.setAccessible(true);
+        cNField.set(remConTest, "test");
+
+        remConTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        remConTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testRemoveContainerEntry() throws Exception {
+        String containerName = "test", nodeId = "1234", portId = "5678";
+        RemoveContainerEntry remConEntTest = new RemoveContainerEntry();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.removeContainerEntry(containerName, nodeId, portId)).thenReturn(result);
+
+        Field cNField = remConEntTest.getClass().getDeclaredField("containerName");
+        cNField.setAccessible(true);
+        Field nIField = remConEntTest.getClass().getDeclaredField("nodeId");
+        nIField.setAccessible(true);
+        Field pIField = remConEntTest.getClass().getDeclaredField("portId");
+        pIField.setAccessible(true);
+
+        cNField.set(remConEntTest, "test");
+        nIField.set(remConEntTest, "1234");
+        pIField.set(remConEntTest, "5678");
+
+        remConEntTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        remConEntTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testRemoveContainerFlow() throws Exception {
+        String containerName = "test", cflowName = "1234";
+        RemoveContainerFlow remConFlowTest = new RemoveContainerFlow();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.removeContainerFlow(containerName, cflowName)).thenReturn(result);
+
+        Field cNField = remConFlowTest.getClass().getDeclaredField("containerName");
+        cNField.setAccessible(true);
+        Field cfField = remConFlowTest.getClass().getDeclaredField("cflowName");
+        cfField.setAccessible(true);
+
+        cNField.set(remConFlowTest, "test");
+        cfField.set(remConFlowTest, "1234");
+
+        remConFlowTest.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        remConFlowTest.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+
+    @Test
+    public void testSaveConfig() throws Exception {
+        SaveConfig saveConfig = new SaveConfig();
+        containerManager = mock(IContainerManagerShell.class);
+        List<String> result = new ArrayList<String>(Arrays.asList("status"));
+        when(containerManager.saveConfig()).thenReturn(result);
+
+        saveConfig.setContainerManager(containerManager);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(baos));
+        saveConfig.doExecute();
+        Assert.assertEquals("status\n", baos.toString());
+    }
+}
\ No newline at end of file
index 67c3045..6a6a12d 100644 (file)
       <type>xml</type>
       <scope>runtime</scope>
     </dependency>
+    <!-- scope is compile so all features (there is only one) are installed
+            into startup.properties and the feature repo itself is not installed -->
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>base-features</artifactId>
       <version>${project.version}</version>
-      <type>kar</type>
+      <type>pom</type>
       <scope>runtime</scope>
     </dependency>
     <dependency>
index 6c1ca42..502e1a2 100644 (file)
@@ -1,17 +1,11 @@
 # Extra packages to import from the boot class loader
 org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch
 
-# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578
-# Extend the framework to avoid the resources to be presented with
-# a URL of type bundleresource: but to be presented as file:
-osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator
 
 # Embedded Tomcat configuration File
 org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
 org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
 
-# Use Equinox as default OSGi Framework Implementation
-karaf.framework=equinox
 
 # Netconf startup configuration
 netconf.tcp.address=127.0.0.1
index ca8c83c..288fe62 100644 (file)
@@ -7,7 +7,7 @@ mvn\:org.ops4j.pax.swissbox/pax-swissbox-bnd/1.7.0 = 5
 mvn\:org.ops4j.pax.url/pax-url-maven-commons/1.6.0 = 5
 mvn\:org.ops4j.pax.url/pax-url-aether/1.6.0 = 5
 mvn\:org.ops4j.pax.url/pax-url-wrap/1.6.0 = 5
-mvn\:javax.annotation/javax.annotation-api/1.2 = 5
+#mvn\:javax.annotation/javax.annotation-api/1.2 = 5
 mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
 mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8
 mvn\:org.apache.karaf.service/org.apache.karaf.service.guard/3.0.1 = 10
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/system.properties b/opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/system.properties
new file mode 100644 (file)
index 0000000..a312d66
--- /dev/null
@@ -0,0 +1,109 @@
+#
+# The properties defined in this file will be made available through system
+# properties at the very beginning of the Karaf's boot process.
+#
+
+# Use Equinox as default OSGi Framework Implementation
+karaf.framework=equinox
+
+# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578
+# Extend the framework to avoid the resources to be presented with
+# a URL of type bundleresource: but to be presented as file:
+osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator
+
+
+# Log level when the pax-logging service is not available
+# This level will only be used while the pax-logging service bundle
+# is not fully available.
+# To change log levels, please refer to the org.ops4j.pax.logging.cfg file
+# instead.
+org.ops4j.pax.logging.DefaultServiceLog.level = ERROR
+
+#
+# Name of this Karaf instance.
+#
+karaf.name = root
+
+#
+# Default repository where bundles will be loaded from before using
+# other Maven repositories.  For the full Maven configuration, see
+# the org.ops4j.pax.url.mvn.cfg file.
+#
+karaf.default.repository = system
+
+#
+# Location of a shell script that will be run when starting a shell
+# session.  This script can be used to create aliases and define
+# additional commands.
+#
+karaf.shell.init.script = ${karaf.etc}/shell.init.script
+
+#
+# Sets the maximum size of the shell command history. If not set,
+# defaults to 500 entries. Setting to 0 will disable history.
+#
+# karaf.shell.history.maxSize = 0
+
+#
+# Deletes the entire karaf.data directory at every start
+#
+karaf.clean.all = false
+
+#
+# Deletes the karaf.data/cache directory at every start
+#
+karaf.clean.cache = false
+
+#
+# Roles to use when logging into a local Karaf console.
+#
+# The syntax is the following:
+#   [classname:]principal
+# where classname is the class name of the principal object
+# (defaults to org.apache.karaf.jaas.modules.RolePrincipal)
+# and principal is the name of the principal of that class
+# (defaults to instance).
+#
+karaf.local.roles = admin,manager,viewer
+
+#
+# Set this empty property to avoid errors when validating xml documents.
+#
+xml.catalog.files =
+
+#
+# Suppress the bell in the console when hitting backspace too many times
+# for example
+#
+jline.nobell = true
+
+#
+# ServiceMix specs options
+#
+org.apache.servicemix.specs.debug = false
+org.apache.servicemix.specs.timeout = 0
+
+#
+# Settings for the OSGi 4.3 Weaving
+# By default, we will not weave any classes. Change this setting to include classes
+# that you application needs to have woven.
+#
+org.apache.aries.proxy.weaving.enabled = none
+# Classes not to weave - Aries default + Xerces which is known to have issues.
+org.apache.aries.proxy.weaving.disabled = org.objectweb.asm.*,org.slf4j.*,org.apache.log4j.*,javax.*,org.apache.xerces.*
+
+#
+# By default, only Karaf shell commands are secured, but additional services can be
+# secured by expanding this filter
+#
+karaf.secured.services = (&(osgi.command.scope=*)(osgi.command.function=*))
+
+#
+# Security properties
+#
+# To enable OSGi security, uncomment the properties below,
+# install the framework-security feature and restart.
+#
+#java.security.policy=${karaf.etc}/all.policy
+#org.osgi.framework.security=osgi
+#org.osgi.framework.trust.repositories=${karaf.etc}/trustStore.ks
diff --git a/pom.xml b/pom.xml
index 8ad0387..a265338 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,7 @@
     <module>opendaylight/hosttracker_new/implementation</module>
     <module>opendaylight/containermanager/api</module>
     <module>opendaylight/containermanager/implementation</module>
+    <module>opendaylight/containermanager/shell</module>
     <module>opendaylight/appauth</module>
     <module>opendaylight/switchmanager/api</module>
     <module>opendaylight/switchmanager/implementation</module>
 
     <!-- Karaf Distribution -->
     <module>features/base</module>
+    <module>features/controller</module>
     <module>opendaylight/dummy-console</module>
     <module>opendaylight/karaf-branding</module>
     <module>opendaylight/distribution/opendaylight-karaf</module>

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.