[ONOS-5805] MEF SCA REST API app for CE App
Migrating MEF SCA API translation app to onos-app-samples.
- Originally developed mainly by Konstantinos Kanonakis <kanonakisk@gmail.com>
Change-Id: Ibf9f9e60c4dcd6375dd135a2f2c7714e3cd7d127
diff --git a/mef-sca-api/examples/sca-elan-create-example.json b/mef-sca-api/examples/sca-elan-create-example.json
new file mode 100644
index 0000000..feeba4c
--- /dev/null
+++ b/mef-sca-api/examples/sca-elan-create-example.json
@@ -0,0 +1,54 @@
+{
+ "evcServiceType": "Multipoint_To_Multipoint",
+ "evcCfgIdentifier": "ELAN1",
+ "SCA_ETH_Flow_Points": [
+ {
+ "evcPerUniCfgIdentifier": "ELAN1-UNI1",
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-1-1",
+ "Hostname": "of:0000000000000001",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni1",
+ "interfaceCfgIngressBwp": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 2000
+ }
+ }
+ },
+ {
+ "evcPerUniCfgIdentifier": "ELAN1-UNI2",
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-2-1",
+ "Hostname": "of:0000000000000002",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni2",
+ "interfaceCfgIngressBwp": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 2000
+ }
+ }
+ },
+ {
+ "evcPerUniCfgIdentifier": "ELAN1-UNI3",
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-3-1",
+ "Hostname": "of:0000000000000003",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni3",
+ "interfaceCfgIngressBwp": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 2000
+ }
+ }
+ }
+ ]
+}
diff --git a/mef-sca-api/examples/sca-epl-create-example.json b/mef-sca-api/examples/sca-epl-create-example.json
new file mode 100644
index 0000000..decd959
--- /dev/null
+++ b/mef-sca-api/examples/sca-epl-create-example.json
@@ -0,0 +1,38 @@
+{
+ "evcServiceType": "Point_To_Point",
+ "evcCfgIdentifier": "ELine1",
+ "SCA_ETH_Flow_Points": [
+ {
+ "evcPerUniCfgIdentifier": "ELine1-UNI1",
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-1-1",
+ "Hostname": "of:0000000000000001",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni1",
+ "interfaceCfgIngressBwp": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 2000
+ }
+ }
+ },
+ {
+ "evcPerUniCfgIdentifier": "ELine1-UNI2",
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-2-1",
+ "Hostname": "of:0000000000000002",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni2",
+ "interfaceCfgIngressBwp": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 2000
+ }
+ }
+ }
+ ]
+}
diff --git a/mef-sca-api/examples/sca-evpl-create-example.json b/mef-sca-api/examples/sca-evpl-create-example.json
new file mode 100644
index 0000000..a3ad5a0
--- /dev/null
+++ b/mef-sca-api/examples/sca-evpl-create-example.json
@@ -0,0 +1,44 @@
+{
+ "evcServiceType": "Point_To_Point",
+ "evcCfgIdentifier": "EVPL1",
+ "SCA_ETH_Flow_Points": [
+ {
+ "evcPerUniCfgIdentifier": "EVPL1-UNI1",
+ "ingressBandwidthProfilePerEvc": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 1000000,
+ "bwpCfgCbs": 3000,
+ "bwpCfgEir": 1000000,
+ "bwpCfgEbs": 3000
+ },
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-1-1",
+ "Hostname": "of:0000000000000001",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni1",
+ "ceVlanId": "100"
+ }
+ },
+ {
+ "evcPerUniCfgIdentifier": "EVPL1-UNI2",
+ "ingressBandwidthProfilePerEvc": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 1000000,
+ "bwpCfgCbs": 3000,
+ "bwpCfgEir": 1000000,
+ "bwpCfgEbs": 3000
+ },
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-2-1",
+ "Hostname": "of:0000000000000002",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni2",
+ "ceVlanId": "100"
+ }
+ }
+ ]
+}
diff --git a/mef-sca-api/examples/sca-evpl-update-example.json b/mef-sca-api/examples/sca-evpl-update-example.json
new file mode 100644
index 0000000..e3c8020
--- /dev/null
+++ b/mef-sca-api/examples/sca-evpl-update-example.json
@@ -0,0 +1,45 @@
+{
+ "id": "EVP-Line-1",
+ "evcServiceType": "Point_To_Point",
+ "evcCfgIdentifier": "EVPL1",
+ "SCA_ETH_Flow_Points": [
+ {
+ "evcPerUniCfgIdentifier": "EVPL1-UNI1",
+ "ingressBandwidthProfilePerEvc": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 3000,
+ "bwpCfgEir": 2000000,
+ "bwpCfgEbs": 3000
+ },
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-1-1",
+ "Hostname": "of:0000000000000001",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni1",
+ "ceVlanId": "200"
+ }
+ },
+ {
+ "evcPerUniCfgIdentifier": "EVPL1-UNI2",
+ "ingressBandwidthProfilePerEvc": {
+ "bwpCfgIdentifier": "",
+ "bwpCfgCir": 2000000,
+ "bwpCfgCbs": 3000,
+ "bwpCfgEir": 2000000,
+ "bwpCfgEbs": 3000
+ },
+ "scaEthFppUniN": {
+ "transportPort": {
+ "CLLI": "CPqD-2-1",
+ "Hostname": "of:0000000000000002",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "uni2",
+ "ceVlanId": "200"
+ }
+ }
+ ]
+}
diff --git a/mef-sca-api/examples/sca-uni-create-example.json b/mef-sca-api/examples/sca-uni-create-example.json
new file mode 100644
index 0000000..acbd320
--- /dev/null
+++ b/mef-sca-api/examples/sca-uni-create-example.json
@@ -0,0 +1,8 @@
+{
+ "transportPort": {
+ "CLLI": "CPqD-1-1",
+ "Hostname": "of:0000000000000003",
+ "Port": "1"
+ },
+ "interfaceCfgIdentifier": "of:0000000000000003/1"
+}
diff --git a/mef-sca-api/features.xml b/mef-sca-api/features.xml
new file mode 100644
index 0000000..f2f5434
--- /dev/null
+++ b/mef-sca-api/features.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ Copyright 2015 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+ <feature name="${project.artifactId}" version="${project.version}"
+ description="${project.description}">
+ <feature>onos-api</feature>
+ <bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version}</bundle>
+ <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
+ <!-- Extra bundles due to MEF SCA API -->
+ <bundle>mvn:io.swagger/swagger-annotations/${swagger-core-version}</bundle>
+ <bundle>mvn:io.swagger/swagger-core/${swagger-core-version}</bundle>
+ <bundle>mvn:io.swagger/swagger-models/${swagger-core-version}</bundle>
+ <bundle>mvn:io.swagger/swagger-jaxrs/${swagger-core-version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/${jackson.version}</bundle>
+ <bundle>mvn:com.google.guava/guava/18.0</bundle> <!-- swagger needs this -->
+ <bundle>wrap:mvn:org.reflections/reflections/0.9.10</bundle> <!-- swagger needs this -->
+ <!-- End of extra bundles due to MEF SCA API -->
+ </feature>
+</features>
diff --git a/mef-sca-api/pom.xml b/mef-sca-api/pom.xml
new file mode 100644
index 0000000..e10bb16
--- /dev/null
+++ b/mef-sca-api/pom.xml
@@ -0,0 +1,312 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<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.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>1.8.0</version>
+ <relativePath/><!-- parent is remote -->
+ </parent>
+
+ <groupId>org.onosproject</groupId>
+ <artifactId>mef-sca-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <description>ONOS MEF SCA API application for Carrier Ethernet app</description>
+ <url>http://onosproject.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <onos.version>1.8.0</onos.version>
+ <carrierethernet.version>1.8.0-SNAPSHOT</carrierethernet.version>
+ <onos.app.requires>org.onosproject.ecord.carrierethernet</onos.app.requires>
+ <api.version>1.0.0</api.version>
+ <onos.app.name>org.onosproject.mefscaapi</onos.app.name>
+ <onos.app.title>MEF SCA REST API</onos.app.title>
+ <onos.app.category>default</onos.app.category>
+ <api.description>MEF SCA REST API for Carrier Ethernet app</api.description>
+ <web.context>/onos/mef-sca-api</web.context>
+ <api.title>MEF SCA REST API</api.title>
+ <onos.app.url>http://onosproject.org</onos.app.url>
+ <api.package>org.onosproject.mefscaapi</api.package>
+ <onos.app.readme>MEF SCA REST API for Carrier Ethernet app</onos.app.readme>
+ <!-- Extra properties due to MEF SCA API -->
+ <swagger-core-version>1.5.10</swagger-core-version>
+ <servlet-api-version>2.5</servlet-api-version>
+ <jersey2-version>2.22.2</jersey2-version>
+ <!-- End of extra properties due to MEF SCA API -->
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-osgi</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-rest</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-cli</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-rest</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-app-carrierethernet</artifactId>
+ <version>${carrierethernet.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Extra dependencies due to MEF SCA API code -->
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <scope>compile</scope>
+ <version>${swagger-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${servlet-api-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-multipart</artifactId>
+ </dependency>
+
+ <!-- End of extra dependencies due to MEF SCA API code -->
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <excludes>org/onosproject/mefscaapi/api/factories/**.java</excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <niceManifest>true</niceManifest>
+ <instructions>
+ <_wab>src/main/webapp/</_wab>
+ <Include-Resource>WEB-INF/classes/apidoc/swagger.json=src/main/resources/sca.json,
+ {maven-resources}</Include-Resource>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ *,
+ org.glassfish.jersey.servlet
+ </Import-Package>
+ <Web-ContextPath>${web.context}</Web-ContextPath>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <excludes>
+ <exclude>**/exclude/*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-scr-srcdescriptor</id>
+ <goals>
+ <goal>scr</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <scanClasses>true</scanClasses>
+ <supportedProjectTypes>
+ <supportedProjectType>bundle</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/sca.json</inputSpec>
+ <language>jaxrs</language>
+ <library>jersey2</library>
+ <!-- will selectively add sourceFolder by build-helper-maven-plugin -->
+ <addCompileSourceRoot>false</addCompileSourceRoot>
+ <output>${project.build.directory}/swagger/</output>
+ <configOptions>
+ <title>MEF SCA REST Application</title>
+ <!-- This adds dependency to jersey1 classes -->
+ <!-- <dateLibrary>java8</dateLibrary> -->
+ <apiPackage>org.onosproject.mefscaapi.api</apiPackage>
+ <modelPackage>org.onosproject.mefscaapi.api.model</modelPackage>
+ <!-- workaround for StringUtil package location -->
+ <invokerPackage>org.onosproject.mefscaapi.api</invokerPackage>
+ <sourceFolder>src/main/java</sourceFolder>
+ <hideGenerationTimestamp>true</hideGenerationTimestamp>
+ <implFolder>impl/main/java/exclude</implFolder>
+ <library>jersey2</library>
+ <!-- Workaround until swagger-code-gen 2.2.2 is released.
+ https://github.com/swagger-api/swagger-codegen/issues/3509
+ -->
+ <additional-properties>jackson=true</additional-properties>
+ </configOptions>
+ <!-- Workaround until swagger-code-gen 2.2.2 is released.
+ https://github.com/swagger-api/swagger-codegen/issues/3509
+ -->
+ <templateDirectory>${basedir}/swaggergen/template</templateDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.11</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <!-- only import generated sourceFolder -->
+ <source>${project.build.directory}/swagger/src/main/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/ApiDocRegistrator.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/ApiDocRegistrator.java
new file mode 100644
index 0000000..20ca056
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/ApiDocRegistrator.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.mefscaapi;
+
+import org.apache.felix.scr.annotations.Component;
+import org.onosproject.rest.AbstractApiDocRegistrator;
+import org.onosproject.rest.ApiDocProvider;
+
+// Usually onos-maven-plugin generates swagger.json and generate equivalent.
+// But this app is generated "from" swagger, so equivalent is not auto-generated
+// by the plugin. Manually creating one.
+@Component(immediate = true)
+public class ApiDocRegistrator extends AbstractApiDocRegistrator {
+ public ApiDocRegistrator() {
+ // sync with pom.xml web.context
+ super(new ApiDocProvider("/onos/mef-sca-api",
+ "MEF SCA REST API",
+ ApiDocRegistrator.class.getClassLoader()));
+ }
+}
\ No newline at end of file
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/MefScaApiAppComponent.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/MefScaApiAppComponent.java
new file mode 100644
index 0000000..c9931ef
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/MefScaApiAppComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.mefscaapi;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Skeletal ONOS application component.
+ */
+@Component(immediate = true)
+public class MefScaApiAppComponent {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Activate
+ protected void activate() {
+ log.info("Started");
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ log.info("Stopped");
+ }
+
+}
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/MefScaApiWebApplication.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/MefScaApiWebApplication.java
new file mode 100644
index 0000000..57b3d01
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/MefScaApiWebApplication.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.mefscaapi;
+
+import org.onlab.rest.AbstractWebApplication;
+import org.onosproject.mefscaapi.api.JacksonJsonProvider;
+import org.onosproject.mefscaapi.api.SCAETHFDFrECApi;
+import org.onosproject.mefscaapi.api.SCAETHFPPUNINApi;
+import org.onosproject.mefscaapi.api.SCAETHFlowDomainApi;
+
+import java.util.Set;
+
+/**
+ * MEF SCA API web application.
+ */
+public class MefScaApiWebApplication extends AbstractWebApplication {
+ @Override
+ public Set<Class<?>> getClasses() {
+ return getClasses(SCAETHFDFrECApi.class, SCAETHFlowDomainApi.class, SCAETHFPPUNINApi.class,
+ JacksonJsonProvider.class);
+ }
+}
+
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFDFrECApiServiceFactory.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFDFrECApiServiceFactory.java
new file mode 100644
index 0000000..7d24646
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFDFrECApiServiceFactory.java
@@ -0,0 +1,12 @@
+package org.onosproject.mefscaapi.api.factories;
+
+import org.onosproject.mefscaapi.api.SCAETHFDFrECApiService;
+import org.onosproject.mefscaapi.api.impl.ScaEthFdFrEcApiServiceImpl;
+
+public class SCAETHFDFrECApiServiceFactory {
+ private final static SCAETHFDFrECApiService service = new ScaEthFdFrEcApiServiceImpl();
+
+ public static SCAETHFDFrECApiService getSCAETHFDFrECApi() {
+ return service;
+ }
+}
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFPPUNINApiServiceFactory.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFPPUNINApiServiceFactory.java
new file mode 100644
index 0000000..7659458
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFPPUNINApiServiceFactory.java
@@ -0,0 +1,12 @@
+package org.onosproject.mefscaapi.api.factories;
+
+import org.onosproject.mefscaapi.api.SCAETHFPPUNINApiService;
+import org.onosproject.mefscaapi.api.impl.ScaEthFppUniNApiServiceImpl;
+
+public class SCAETHFPPUNINApiServiceFactory {
+ private final static SCAETHFPPUNINApiService service = new ScaEthFppUniNApiServiceImpl();
+
+ public static SCAETHFPPUNINApiService getSCAETHFPPUNINApi() {
+ return service;
+ }
+}
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFlowDomainApiServiceFactory.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFlowDomainApiServiceFactory.java
new file mode 100644
index 0000000..98b0545
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/factories/SCAETHFlowDomainApiServiceFactory.java
@@ -0,0 +1,12 @@
+package org.onosproject.mefscaapi.api.factories;
+
+import org.onosproject.mefscaapi.api.SCAETHFlowDomainApiService;
+import org.onosproject.mefscaapi.api.impl.ScaEthFlowDomainApiServiceImpl;
+
+public class SCAETHFlowDomainApiServiceFactory {
+ private final static SCAETHFlowDomainApiService service = new ScaEthFlowDomainApiServiceImpl();
+
+ public static SCAETHFlowDomainApiService getSCAETHFlowDomainApi() {
+ return service;
+ }
+}
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFdFrEcApiServiceImpl.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFdFrEcApiServiceImpl.java
new file mode 100755
index 0000000..8a3c8cc
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFdFrEcApiServiceImpl.java
@@ -0,0 +1,150 @@
+package org.onosproject.mefscaapi.api.impl;
+
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetManager;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection;
+import org.onosproject.mefscaapi.api.ApiResponseMessage;
+import org.onosproject.mefscaapi.api.SCAETHFDFrECApiService;
+import org.onosproject.mefscaapi.api.model.SCAETHFDFrEC;
+import org.onosproject.mefscaapi.translate.ScaApiTranslator;
+import org.slf4j.Logger;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriBuilder;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class ScaEthFdFrEcApiServiceImpl extends SCAETHFDFrECApiService {
+
+ CarrierEthernetManager ceManager = AbstractShellCommand.get(CarrierEthernetManager.class);
+
+ private static final Logger log = getLogger(ScaEthFdFrEcApiServiceImpl.class);
+
+ private static final String CHECK_LOG = " Check ONOS log for details.";
+ private static final String NOT_TRANSLATED = "Could not translate EVC.";
+ private static final String NOT_EXISTS = "EVC does not exist.";
+ private static final String CREATED = "EVC was created successfully.";
+ private static final String UPDATED = "EVC was updated successfully.";
+ private static final String NOT_CREATED = "EVC could not be created.";
+ private static final String REMOVED = "EVC was removed successfully.";
+ private static final String NOT_REMOVED = "EVC could not be removed.";
+ private static final String REFCOUNT_NOT_ZERO = " RefCount is not zero.";
+ private static final String EVC_REL_URI = "SCA_ETH_FDFr_EC/";
+
+ @Override
+ public Response deleteSCAETHFDFrEC(String id, SecurityContext securityContext)
+ throws NotFoundException {
+
+ if (ceManager.getEvc(id) == null) {
+ return response(Response.Status.NOT_FOUND,
+ responseMsg(ApiResponseMessage.ERROR, NOT_EXISTS));
+ } else {
+ // Remove the EVC
+ ceManager.removeEvc(id);
+ return response(Response.Status.OK,
+ responseMsg(ApiResponseMessage.INFO, REMOVED));
+ }
+ }
+
+ @Override
+ public Response findSCAETHFDFrECById(String id, SecurityContext securityContext)
+ throws NotFoundException {
+
+ CarrierEthernetVirtualConnection evc = ceManager.getEvc(id);
+
+ if (evc == null) {
+ return response(Response.Status.NOT_FOUND,
+ responseMsg(ApiResponseMessage.ERROR, NOT_EXISTS));
+ } else {
+ SCAETHFDFrEC scaEvc = ScaApiTranslator.fromCarrierEthernetVirtualConnection(evc);
+ if (scaEvc == null) {
+ return response(Response.Status.INTERNAL_SERVER_ERROR,
+ responseMsg(ApiResponseMessage.ERROR, NOT_TRANSLATED));
+ } else {
+ return response(Response.Status.OK,
+ scaEvc);
+ }
+ }
+ }
+
+ @Override
+ public Response findSCAETHFDFrECByState(String state, SecurityContext securityContext)
+ throws NotFoundException {
+
+ List<SCAETHFDFrEC> scaEvcList = new LinkedList<>();
+ // Browse through all CE FCs and translate them to NRP ones
+ for (CarrierEthernetVirtualConnection ceEvc : ceManager.evcMap().values()) {
+ SCAETHFDFrEC scaEvc =
+ ScaApiTranslator.fromCarrierEthernetVirtualConnection(ceEvc);
+ // If no state is provided, return all EVCs
+ if (scaEvc != null &&
+ (state == null || state.equalsIgnoreCase(scaEvc.getState().toString()))) {
+ scaEvcList.add(scaEvc);
+ }
+ }
+
+ // TODO: Indicate if some of the EVCs could not be translated?
+ return response(Response.Status.OK, scaEvcList);
+ }
+
+ @Override
+ public Response sCAETHFDFrECIdPatch(String id, String state, SecurityContext securityContext)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response sCAETHFDFrECPost(SCAETHFDFrEC scaEthFdFrEc, SecurityContext securityContext)
+ throws NotFoundException {
+
+ log.trace("input: {}", scaEthFdFrEc);
+
+ CarrierEthernetVirtualConnection evc =
+ ScaApiTranslator.toCarrierEthernetVirtualConnection(scaEthFdFrEc);
+
+ if (evc == null) {
+ return response(Response.Status.BAD_REQUEST,
+ responseMsg(ApiResponseMessage.ERROR, NOT_TRANSLATED));
+ } else {
+ boolean serviceExisted =
+ evc.id() != null && ceManager.evcMap().containsKey(evc.id());
+
+ ceManager.installEvc(evc);
+
+ if (evc.isActive()) {
+ String message = serviceExisted ? UPDATED : CREATED;
+ return response(EVC_REL_URI + evc.id(),
+ responseMsg(ApiResponseMessage.INFO, message));
+ } else {
+ // TODO: Find out somehow the reason for the failure
+ return response(Response.Status.INTERNAL_SERVER_ERROR,
+ responseMsg(ApiResponseMessage.ERROR, NOT_CREATED + CHECK_LOG));
+ }
+ }
+ }
+
+ private <T> Response response(Response.Status status, T entity) {
+ return Response
+ .status(status)
+ .entity(entity)
+ .build();
+ }
+
+ private <T> Response response(String uri, T entity) {
+ return Response
+ .created(UriBuilder.fromUri(uri).build())
+ .entity(entity)
+ .build();
+ }
+
+ private ApiResponseMessage responseMsg(int msgCode, String msg) {
+ return new ApiResponseMessage(msgCode, msg == null ? "" : msg);
+ }
+}
+
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFlowDomainApiServiceImpl.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFlowDomainApiServiceImpl.java
new file mode 100755
index 0000000..e2e7a5d
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFlowDomainApiServiceImpl.java
@@ -0,0 +1,24 @@
+package org.onosproject.mefscaapi.api.impl;
+
+import org.onosproject.mefscaapi.api.ApiResponseMessage;
+import org.onosproject.mefscaapi.api.NotFoundException;
+import org.onosproject.mefscaapi.api.SCAETHFlowDomainApiService;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
+
+public class ScaEthFlowDomainApiServiceImpl extends SCAETHFlowDomainApiService {
+
+ @Override
+ public Response getSCAETHFlowDomain(SecurityContext securityContext) throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response getSCAETHFlowDomainById(String id, SecurityContext securityContext) throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+}
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFppUniNApiServiceImpl.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFppUniNApiServiceImpl.java
new file mode 100755
index 0000000..3090404
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/ScaEthFppUniNApiServiceImpl.java
@@ -0,0 +1,120 @@
+package org.onosproject.mefscaapi.api.impl;
+
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetManager;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetUni;
+import org.onosproject.mefscaapi.api.ApiResponseMessage;
+import org.onosproject.mefscaapi.api.NotFoundException;
+import org.onosproject.mefscaapi.api.SCAETHFPPUNINApiService;
+import org.onosproject.mefscaapi.api.model.SCAETHFPPUNIN;
+import org.onosproject.mefscaapi.api.model.SCAETHFlowPoint;
+import org.onosproject.mefscaapi.translate.ScaApiTranslator;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriBuilder;
+import java.util.LinkedList;
+import java.util.List;
+
+public class ScaEthFppUniNApiServiceImpl extends SCAETHFPPUNINApiService {
+
+ CarrierEthernetManager ceManager = AbstractShellCommand.get(CarrierEthernetManager.class);
+
+ private static final String NOT_TRANSLATED = "Could not translate UNI.";
+ private static final String EXISTS = "UNI already exists.";
+ private static final String NOT_EXISTS = "UNI does not exist.";
+ private static final String CREATED = "UNI was created successfully.";
+ private static final String REMOVED = "UNI was removed successfully.";
+ private static final String NOT_REMOVED = "UNI could not be removed.";
+ private static final String REFCOUNT_NOT_ZERO = " RefCount is not zero.";
+ private static final String UNI_REL_URI = "SCA_ETH_FPP_UNI_N/";
+
+ @Override
+ public Response createSCAETHFPPUNIN(SCAETHFPPUNIN uni, SecurityContext securityContext) throws NotFoundException {
+
+ // Create SCA Flow Point and add provided SCA UNI to it
+ SCAETHFlowPoint scaFlowPoint = new SCAETHFlowPoint();
+ scaFlowPoint.setScaEthFppUniN(uni);
+
+ CarrierEthernetUni ceUni = ScaApiTranslator.toCarrierEthernetUni(scaFlowPoint, null);
+ if (ceUni == null) {
+ return response(Response.Status.BAD_REQUEST,
+ responseMsg(ApiResponseMessage.ERROR, NOT_TRANSLATED));
+ } else if (ceManager.addGlobalUni(ceUni) == null) {
+ return response(Response.Status.FORBIDDEN,
+ responseMsg(ApiResponseMessage.ERROR, EXISTS));
+ } else {
+ return response(UNI_REL_URI + ceUni.id(),
+ responseMsg(ApiResponseMessage.INFO, CREATED));
+ }
+ }
+
+ @Override
+ public Response deleteSCAETHFPPUNIN(String uniID, SecurityContext securityContext) throws NotFoundException {
+
+ if (ceManager.getUniMap().get(uniID) == null) {
+ return response(Response.Status.NOT_FOUND,
+ responseMsg(ApiResponseMessage.ERROR, NOT_EXISTS));
+ } else if (ceManager.removeGlobalUni(uniID) == null) {
+ return response(Response.Status.FORBIDDEN,
+ responseMsg(ApiResponseMessage.ERROR, NOT_REMOVED + REFCOUNT_NOT_ZERO));
+ } else {
+ return response(Response.Status.OK,
+ responseMsg(ApiResponseMessage.INFO, REMOVED));
+ }
+ }
+
+ @Override
+ public Response findSCAETHFPPUNIN(String fields, SecurityContext securityContext) throws NotFoundException {
+
+ List<SCAETHFPPUNIN> scaUniList = new LinkedList<>();
+
+ // Add all global UNIs if they are not there already
+ ceManager.getUnisFromTopo(false, false).forEach(uni -> ceManager.addGlobalUni(uni));
+
+ // Browse through all global CE UNIs and translate them to SCA ones
+ for (CarrierEthernetUni ceUni : ceManager.getUniMap().values()) {
+ // TODO: Match on provided fields
+ SCAETHFlowPoint scaFlowPoint = ScaApiTranslator.fromCarrierEthernetUni(ceUni);
+ if (scaFlowPoint != null) {
+ scaUniList.add(scaFlowPoint.getScaEthFppUniN());
+ }
+ }
+
+ // TODO: Indicate if some of the Flow Points could not be translated?
+ return response(Response.Status.OK, scaUniList);
+ }
+
+ @Override
+ public Response getSCAETHFPPUNIN(String uniID, String fields, SecurityContext securityContext)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response patchSCAETHFPPUNIN(String uniID, SCAETHFPPUNIN individual, SecurityContext securityContext)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ private <T> Response response(Response.Status status, T entity) {
+ return Response
+ .status(status)
+ .entity(entity)
+ .build();
+ }
+
+ private <T> Response response(String uri, T entity) {
+ return Response
+ .created(UriBuilder.fromUri(uri).build())
+ .entity(entity)
+ .build();
+ }
+
+ private ApiResponseMessage responseMsg(int msgCode, String msg) {
+ return new ApiResponseMessage(msgCode, msg == null ? "" : msg);
+ }
+}
+
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/package-info.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/package-info.java
new file mode 100644
index 0000000..ba2296b
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/api/impl/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+/**
+ * MEF SCA API implementations.
+ */
+package org.onosproject.mefscaapi.api.impl;
\ No newline at end of file
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/package-info.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/package-info.java
new file mode 100644
index 0000000..324b59d
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+/**
+ * MEF SCA app.
+ */
+package org.onosproject.mefscaapi;
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/translate/ScaApiTranslator.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/translate/ScaApiTranslator.java
new file mode 100644
index 0000000..8c02670
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/translate/ScaApiTranslator.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.mefscaapi.translate;
+
+import org.onlab.util.Bandwidth;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetBandwidthProfile;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetConnection;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetUni;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection;
+import org.onlab.packet.VlanId;
+import org.onosproject.mefscaapi.api.model.SCAETHFDFrEC;
+import org.onosproject.mefscaapi.api.model.SCAETHFPPUNIN;
+import org.onosproject.mefscaapi.api.model.SCAETHFPPUNINTransportPort;
+import org.onosproject.mefscaapi.api.model.SCAETHFlowPoint;
+import org.onosproject.mefscaapi.api.model.SCAETHFlowPointClassOfServiceIdentifierIp;
+import org.onosproject.mefscaapi.api.model.SCAETHFlowPointIngressBandwidthProfilePerClassOfServiceIdentifier;
+import org.onosproject.mefscaapi.api.model.SCAETHFlowPointIngressBandwidthProfilePerEvc;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.DeviceService;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Methods for translating between SCA API swagger-generated JAVA classes and CE App classes.
+ */
+public final class ScaApiTranslator {
+
+ private static DeviceService deviceService = AbstractShellCommand.get(DeviceService.class);
+
+ private static final Logger log = getLogger(ScaApiTranslator.class);
+
+ // Not to be called
+ private ScaApiTranslator() {
+ }
+
+ public static CarrierEthernetVirtualConnection toCarrierEthernetVirtualConnection(SCAETHFDFrEC scaethfdFrEC) {
+
+ String evcId = scaethfdFrEC.getId();
+ String evcCfgId = scaethfdFrEC.getEvcCfgIdentifier();
+ CarrierEthernetVirtualConnection.Type evcType =
+ CarrierEthernetVirtualConnection.Type.valueOf(scaethfdFrEC.getEvcServiceType().name());
+ Integer maxNumUni = scaethfdFrEC.getEvcStatusMaxNumUni();
+ Set<CarrierEthernetUni> uniSet = new HashSet<>();
+
+ CarrierEthernetUni ceUni;
+ CarrierEthernetUni.Role ceUniRole = CarrierEthernetUni.Role.ROOT;
+ ListIterator<SCAETHFlowPoint> it = scaethfdFrEC.getSCAETHFlowPoints().listIterator();
+ while (it.hasNext()) {
+ if (evcType.equals(CarrierEthernetConnection.Type.ROOT_MULTIPOINT)) {
+ ceUniRole = (it.nextIndex() == 0) ? CarrierEthernetUni.Role.ROOT : CarrierEthernetUni.Role.LEAF;
+ }
+ SCAETHFlowPoint scaFlowPoint = it.next();
+ // Create new CE UNI
+ ceUni = toCarrierEthernetUni(scaFlowPoint, ceUniRole);
+ if (ceUni == null) {
+ return null;
+ }
+ uniSet.add(ceUni);
+ }
+
+ return CarrierEthernetVirtualConnection.builder()
+ .id(evcId)
+ .cfgId(evcCfgId)
+ .type(evcType)
+ .maxNumUni(maxNumUni)
+ .uniSet(uniSet)
+ .build();
+ }
+
+ public static SCAETHFDFrEC fromCarrierEthernetVirtualConnection(CarrierEthernetVirtualConnection ceService) {
+
+ SCAETHFDFrEC scaethfdFrEC = new SCAETHFDFrEC();
+
+ scaethfdFrEC.setId(ceService.id());
+ scaethfdFrEC.setEvcCfgIdentifier(ceService.cfgId());
+ scaethfdFrEC.setEvcServiceType(SCAETHFDFrEC.EvcServiceTypeEnum.valueOf(ceService.type().name()));
+ scaethfdFrEC.setEvcStatusMaxNumUni(ceService.maxNumUni());
+ scaethfdFrEC.setState(SCAETHFDFrEC.StateEnum.valueOf(ceService.state().name()));
+
+ List<SCAETHFlowPoint> scaFlowPointList = new ArrayList<>();
+ SCAETHFlowPoint scaFlowpoint;
+
+ Iterator<CarrierEthernetUni> it = ceService.uniSet().iterator();
+ while (it.hasNext()) {
+ CarrierEthernetUni ceUni = it.next();
+ // Create new SCA Flow Point from CE UNI (will also create an SCA UNI internally)
+ scaFlowpoint = fromCarrierEthernetUni(ceUni);
+ scaFlowPointList.add(scaFlowpoint);
+ }
+
+ scaethfdFrEC.setSCAETHFlowPoints(scaFlowPointList);
+
+ return scaethfdFrEC;
+ }
+
+ public static CarrierEthernetUni toCarrierEthernetUni(SCAETHFlowPoint scaFlowPoint,
+ CarrierEthernetUni.Role ceUniRole) {
+
+ // TODO: Check for null
+
+ // Get SCA UNI from SCA Flow Point
+ SCAETHFPPUNIN scaUni = scaFlowPoint.getScaEthFppUniN();
+
+ // Get UNI id
+ String ceUniCfgId = scaUni.getInterfaceCfgIdentifier();
+
+ // Get CE UNI CE-VLAN id
+ VlanId ceVlanId = ((scaUni.getCeVlanId() == null) ? null :
+ VlanId.vlanId(Short.valueOf(scaUni.getCeVlanId())));
+
+ // TODO: Allow for both ingress and egress BW profiles
+ // Get CE UNI BW profile
+ CarrierEthernetBandwidthProfile ceBwp = getCeBwpFromScaFlowPoint(scaFlowPoint);
+
+ // Get CE UNI connect point
+ DeviceId deviceId = DeviceId.deviceId(scaUni.getTransportPort().getHostname());
+ if (deviceService.getDevice(deviceId) == null) {
+ log.error("Invalid deviceId {}", deviceId);
+ return null;
+ }
+ PortNumber portNumber = PortNumber.portNumber(scaUni.getTransportPort().getPort());
+ if (deviceService.getPort(deviceId, portNumber) == null) {
+ log.error("Invalid port {} for device {}", portNumber, deviceId);
+ return null;
+ }
+ ConnectPoint ceUniCp = new ConnectPoint(deviceId, portNumber);
+
+ // Create CE UNI
+ return CarrierEthernetUni.builder()
+ .cp(ceUniCp)
+ .cfgId(ceUniCfgId)
+ .role(ceUniRole)
+ .ceVlanId(ceVlanId)
+ .bwp(ceBwp)
+ .build();
+ }
+
+ public static SCAETHFlowPoint fromCarrierEthernetUni(CarrierEthernetUni ceUni) {
+
+ SCAETHFlowPoint scaFlowPoint = new SCAETHFlowPoint();
+ SCAETHFPPUNIN scaUni = new SCAETHFPPUNIN();
+
+ // Set SCA UNI Transport Port
+ SCAETHFPPUNINTransportPort scaPort = new SCAETHFPPUNINTransportPort();
+ scaPort.setHostname(ceUni.cp().deviceId().toString());
+ scaPort.setPort(ceUni.cp().port().toString());
+ scaPort.setVendor(deviceService.getDevice(ceUni.cp().deviceId()).manufacturer());
+ scaUni.setTransportPort(scaPort);
+ if (ceUni.ceVlanId() != null) {
+ scaUni.setCeVlanId(ceUni.ceVlanId().toString());
+ }
+
+ scaUni.setInterfaceCfgIdentifier(ceUni.cfgId());
+
+ // Add SCA UNI to SCA Flow Point
+ scaFlowPoint.setScaEthFppUniN(scaUni);
+
+ // TODO: Allow for both ingress and egress BW profiles
+ // FIXME: A CE UNI may have multiple bandwidth profiles
+
+ // Apply existing BW profile from CE UNI to SCA Flow Point (or UNI)
+ applyCeUniBwpToScaFlowPoint(ceUni, scaFlowPoint);
+
+ // TODO: Check if the UNI type needs to be specified
+
+ return scaFlowPoint;
+ }
+
+ private static CarrierEthernetBandwidthProfile getCeBwpFromScaFlowPoint(
+ SCAETHFlowPoint scaFlowPoint) {
+
+ SCAETHFPPUNIN scaUni = scaFlowPoint.getScaEthFppUniN();
+ SCAETHFlowPointIngressBandwidthProfilePerEvc scaBwp = null;
+ SCAETHFlowPointIngressBandwidthProfilePerClassOfServiceIdentifier scaCosBwp = null;
+ String ceBwpId = null;
+ String ceBwpCfgId;
+ CarrierEthernetBandwidthProfile.Type ceBwpType;
+
+ SCAETHFlowPointIngressBandwidthProfilePerEvc ifaceBwp =
+ scaUni.getInterfaceCfgIngressBwp();
+ SCAETHFlowPointIngressBandwidthProfilePerEvc evcBwp =
+ scaFlowPoint.getIngressBandwidthProfilePerEvc();
+ SCAETHFlowPointIngressBandwidthProfilePerClassOfServiceIdentifier cosBwp =
+ scaFlowPoint.getIngressBandwidthProfilePerClassOfServiceIdentifier();
+
+ // TODO: Complete the COS part
+
+ // FIXME: Perform following check
+ /*Preconditions.checkArgument(ifaceBwp == null && evcBwp == null && cosBwp == null ||
+ (ifaceBwp != null ^ evcBwp != null ^ cosBwp != null),
+ "Only up to one BW profile can be set per UNI");*/
+
+ if (evcBwp != null) {
+ scaBwp = evcBwp;
+ ceBwpCfgId = scaBwp.getBwpCfgIdentifier();
+ ceBwpType = CarrierEthernetBandwidthProfile.Type.EVC;
+ } else if (ifaceBwp != null) {
+ scaBwp = ifaceBwp;
+ // Use the UNI connect point id
+ ceBwpId = scaUni.getTransportPort().getHostname() + "/" + scaUni.getTransportPort().getPort();
+ ceBwpType = CarrierEthernetBandwidthProfile.Type.INTERFACE;
+ ceBwpCfgId = ifaceBwp.getBwpCfgIdentifier();
+ if (ceBwpCfgId == null) {
+ ceBwpCfgId = ceBwpId;
+ }
+ } else if (cosBwp != null) {
+ // FIXME: Complete and test the COS part
+ scaCosBwp = cosBwp;
+ SCAETHFlowPointClassOfServiceIdentifierIp scaCosIdIp =
+ scaFlowPoint.getClassOfServiceIdentifierIp();
+ if (scaCosIdIp == null) {
+ log.error("CoS ID is required for COS BW profile");
+ return null;
+ }
+ ceBwpId = scaCosIdIp.getClassOfServiceName();
+ ceBwpCfgId = scaCosBwp.getBwpCfgIdentifier();
+ ceBwpType = CarrierEthernetBandwidthProfile.Type.COS;
+ } else {
+ return null;
+ }
+
+ CeBwpParams ceBwpParams = scaBwp != null ? new CeBwpParams(scaBwp) :
+ new CeBwpParams(scaCosBwp);
+
+ return CarrierEthernetBandwidthProfile.builder()
+ .id(ceBwpId)
+ .cfgId(ceBwpCfgId)
+ .type(ceBwpType)
+ .cir(ceBwpParams.cir())
+ .cbs(ceBwpParams.cbs())
+ .eir(ceBwpParams.eir())
+ .ebs(ceBwpParams.ebs())
+ .build();
+ }
+
+ private static class CeBwpParams {
+
+ private Bandwidth cir = Bandwidth.bps((long) 0);
+ private Bandwidth eir = Bandwidth.bps((long) 0);
+ private long cbs = (long) 0;
+ private long ebs = (long) 0;
+
+ CeBwpParams() {}
+
+ CeBwpParams(SCAETHFlowPointIngressBandwidthProfilePerEvc scaBwp) {
+ if (scaBwp.getBwpCfgCir() != null) {
+ cir = Bandwidth.bps((long) scaBwp.getBwpCfgCir());
+ }
+ if (scaBwp.getBwpCfgEir() != null) {
+ eir = Bandwidth.bps((long) scaBwp.getBwpCfgEir());
+ }
+ if (scaBwp.getBwpCfgCbs() != null) {
+ cbs = (long) scaBwp.getBwpCfgCbs();
+ }
+ if (scaBwp.getBwpCfgEbs() != null) {
+ ebs = (long) scaBwp.getBwpCfgEbs();
+ }
+ }
+
+ CeBwpParams(SCAETHFlowPointIngressBandwidthProfilePerClassOfServiceIdentifier scaBwp) {
+ if (scaBwp.getBwpCfgCir() != null) {
+ cir = Bandwidth.bps((long) scaBwp.getBwpCfgCir());
+ }
+ if (scaBwp.getBwpCfgEir() != null) {
+ eir = Bandwidth.bps((long) scaBwp.getBwpCfgEir());
+ }
+ if (scaBwp.getBwpCfgCbs() != null) {
+ cbs = (long) scaBwp.getBwpCfgCbs();
+ }
+ if (scaBwp.getBwpCfgEbs() != null) {
+ ebs = (long) scaBwp.getBwpCfgEbs();
+ }
+ }
+
+ public Bandwidth cir() {
+ return cir;
+ }
+
+ public Bandwidth eir() {
+ return eir;
+ }
+
+ public long cbs() {
+ return cbs;
+ }
+
+ public long ebs() {
+ return ebs;
+ }
+ }
+
+ private static SCAETHFlowPoint applyCeUniBwpToScaFlowPoint(
+ CarrierEthernetUni ceUni, SCAETHFlowPoint scaFlowPoint) {
+
+ CarrierEthernetBandwidthProfile ceBwp = ceUni.bwp();
+
+ SCAETHFlowPoint newScaFlowPoint = scaFlowPoint;
+ SCAETHFPPUNIN newScaUni = scaFlowPoint.getScaEthFppUniN();
+
+ if (ceBwp != null) {
+ // Prepare SCA bandwidth profile
+ SCAETHFlowPointIngressBandwidthProfilePerEvc scaBwp = new SCAETHFlowPointIngressBandwidthProfilePerEvc();
+
+ // TODO: Check for null?
+ scaBwp.setBwpCfgCir((int) ceBwp.cir().bps());
+ scaBwp.setBwpCfgCbs((int) ceBwp.cbs());
+ scaBwp.setBwpCfgEir((int) ceBwp.eir().bps());
+ scaBwp.setBwpCfgEbs((int) ceBwp.ebs());
+
+ // TODO: Add the CoS part when it's ready from the CE app side
+ if (ceBwp.type().equals(CarrierEthernetBandwidthProfile.Type.EVC)) {
+ newScaUni.setEvcId(ceBwp.id());
+ newScaFlowPoint.setIngressBandwidthProfilePerEvc(scaBwp);
+ } else if (ceBwp.type().equals(CarrierEthernetBandwidthProfile.Type.INTERFACE)) {
+ newScaUni.setInterfaceCfgIdentifier(ceUni.cfgId());
+ newScaUni.setInterfaceCfgIngressBwp(scaBwp);
+ } else {
+ log.error("Could not add BW profile for Flow Point {}", scaFlowPoint.toString());
+ return null;
+ }
+ }
+
+ newScaFlowPoint.setScaEthFppUniN(newScaUni);
+
+ return newScaFlowPoint;
+ }
+
+}
diff --git a/mef-sca-api/src/main/java/org/onosproject/mefscaapi/translate/package-info.java b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/translate/package-info.java
new file mode 100644
index 0000000..daeec94
--- /dev/null
+++ b/mef-sca-api/src/main/java/org/onosproject/mefscaapi/translate/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+/**
+ * MEF SCA app utilities.
+ */
+package org.onosproject.mefscaapi.translate;
diff --git a/mef-sca-api/src/main/resources/README b/mef-sca-api/src/main/resources/README
new file mode 100644
index 0000000..746d7ce
--- /dev/null
+++ b/mef-sca-api/src/main/resources/README
@@ -0,0 +1,4 @@
+
+
+sca.json:
+ MEF SCA API definition taken from https://app.swaggerhub.com/api/jtpugac/MEF-SCA/1.0
diff --git a/mef-sca-api/src/main/resources/sca.json b/mef-sca-api/src/main/resources/sca.json
new file mode 100644
index 0000000..ce30b1a
--- /dev/null
+++ b/mef-sca-api/src/main/resources/sca.json
@@ -0,0 +1,1328 @@
+
+
+{
+ "swagger": "2.0",
+ "info": {
+ "description": "MEF Forum Service Configuration and Activation API",
+ "version": "1.0",
+ "title": "MEF SCA API"
+ },
+ "basePath": "\/onos\/mef-sca-api",
+ "schemes": [
+ "http"
+ ],
+ "produces": [
+ "application\/json"
+ ],
+ "paths": {
+ "\/SCA_ETH_FDFr_EC": {
+ "post": {
+ "tags": [
+ "SCA_ETH_FDFr_EC"
+ ],
+ "description": "Create, Create and Activate Ethernet Flow Domain Fragment. Use state variable for action. ",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "SCA_ETH_FDFr_EC",
+ "required": true,
+ "in": "body",
+ "description": "SCA_ETH_FDFr_EC",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ethernet Flow Domain Fragment EC",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ },
+ "400": {
+ "description": "Error has occurred",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_Error_Response"
+ }
+ }
+ }
+ }
+ },
+ "\/SCA_ETH_FDFr_EC\/{id}": {
+ "patch": {
+ "tags": [
+ "SCA_ETH_FDFr_EC"
+ ],
+ "description": "Activate or Deactivate an existing Ethernet Flow Domain Fragment (SCA_ETH_FDFr_EC) identified with {id}. Use state variable for action. ",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "description": "id of Ethernet Flow Domain Fragment",
+ "type": "string"
+ },
+ {
+ "name": "state",
+ "in": "query",
+ "description": "state of SCA_ETH_FDFr_EC",
+ "type": "string",
+ "enum": [
+ "active",
+ "inactive",
+ "suspended",
+ "terminated"
+ ],
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ethernet Flow Domain Fragment EC",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ },
+ "400": {
+ "description": "Invalid SCA_ETH_FDFr PATCH"
+ }
+ }
+ },
+ "delete": {
+ "tags": [
+ "SCA_ETH_FDFr_EC"
+ ],
+ "operationId": "deleteSCA_ETH_FDFr_EC",
+ "summary": "Delete SCA_ETH_FDFr_EC with {id}",
+ "description": "Delete Ethernet Flow Domain Fragment with {id}",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "description": "id of Ethernet Flow Domain Fragment",
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Delete SCA_ETH_FDFr_EC uniquely identified by id",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ },
+ "400": {
+ "description": "Invalid SCA_ETH_FDFr_EC identifier"
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "SCA_ETH_FDFr_EC"
+ ],
+ "operationId": "findSCA_ETH_FDFr_EC_ById",
+ "summary": "Finds SCA_ETH_FDFr by id",
+ "description": "Finds Ethernet Flow Domain Fragment by id",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "description": "id of Ethernet Flow Domain Fragment",
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "SCA_ETH_FDFr_EC",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ }
+ }
+ }
+ },
+ "\/SCA_ETH_FDFr_EC\/findByState": {
+ "get": {
+ "tags": [
+ "SCA_ETH_FDFr_EC"
+ ],
+ "operationId": "findSCA_ETH_FDFr_EC_ByState",
+ "summary": "Find SCA_ETH_FDFr_EC by state",
+ "description": "Finds Ethernet Flow Domain Fragments based on state",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "state",
+ "in": "query",
+ "required": false,
+ "description": "",
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "SCA_ETH_FDFr_EC",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ }
+ }
+ }
+ }
+ },
+ "\/SCA_ETH_FPP_UNI_N": {
+ "post": {
+ "tags": [
+ "SCA_ETH_FPP_UNI_N"
+ ],
+ "operationId": "createSCA_ETH_FPP_UNI_N",
+ "summary": "Create\/Create and Activate a SCA_ETH_FPP_UNI_N",
+ "description": "Create or Create and Activate an Ethernet Flow Point Pool UNI_N",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "uni",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "uni",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "SCA_ETH_FPP_UNI_N"
+ ],
+ "operationId": "findSCA_ETH_FPP_UNI_N",
+ "summary": "Find SCA_ETH_FPP_UNI_N(s) managed by Domain Controller",
+ "description": "Find all Ethernet Flow Point Pool UNI_Ns managed b Domain Controller",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "fields",
+ "in": "query",
+ "required": false,
+ "description": "",
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "List of SCA_ETH_FPP_UNI_N",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ }
+ }
+ }
+ }
+ }
+ },
+ "\/SCA_ETH_FPP_UNI_N\/{uniID}": {
+ "delete": {
+ "tags": [
+ "SCA_ETH_FPP_UNI_N"
+ ],
+ "operationId": "deleteSCA_ETH_FPP_UNI_N",
+ "summary": "Delete SCA_ETH_FPP_UNI_N with {id}",
+ "description": "Delete Ethernet Flow Point Pool UNI_N with {id}",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "uniID",
+ "in": "path",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Success"
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "SCA_ETH_FPP_UNI_N"
+ ],
+ "operationId": "getSCA_ETH_FPP_UNI_N",
+ "summary": "Get all SCA_ETH_FPP_UNI_N managed by Domain Controller",
+ "description": "Get all Ethernet Flow Point Pool UNI_Ns managed by Domain Controller",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "uniID",
+ "in": "path",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "fields",
+ "in": "query",
+ "required": false,
+ "description": "",
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "SCA_ETH_FPP_UNI_N",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ }
+ }
+ }
+ },
+ "patch": {
+ "tags": [
+ "SCA_ETH_FPP_UNI_N"
+ ],
+ "operationId": "patchSCA_ETH_FPP_UNI_N",
+ "summary": "Modify SCA_ETH_FPP_UNI_N",
+ "description": "Modify Ethernet Flow Point Pool UNI_N",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "uniID",
+ "in": "path",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "individual",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Success Individual",
+ "schema": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ }
+ }
+ }
+ }
+ },
+ "\/SCA_ETH_Flow_Domain": {
+ "get": {
+ "tags": [
+ "SCA_ETH_Flow_Domain"
+ ],
+ "operationId": "getSCA_ETH_Flow_Domain",
+ "summary": "Get all SCA_ETH_Flow_Domains",
+ "description": "List all of Ethernet Flow Domains managed by Domain Controller",
+ "deprecated": false,
+ "responses": {
+ "200": {
+ "description": "List of SCA_ETH_Flow_Domains",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_Flow_Domain"
+ }
+ }
+ }
+ }
+ }
+ },
+ "\/SCA_ETH_Flow_Domain\/{id}": {
+ "get": {
+ "tags": [
+ "SCA_ETH_Flow_Domain"
+ ],
+ "operationId": "getSCA_ETH_Flow_DomainById",
+ "summary": "Get the SCA_ETH_Flow_Domain identified by {id}",
+ "description": "List the SCA Ethernet Flow Domain managed by Domain Controller with {id}",
+ "deprecated": false,
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "List of SCA_Flow_Domains",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_Flow_Domain"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "SCA_ETH_Flow_Point": {
+ "type": "object",
+ "properties": {
+ "evcPerUniCfgIdentifier": {
+ "type": "string"
+ },
+ "scaEthFppUniN": {
+ "type": "object",
+ "$ref": "#\/definitions\/SCA_ETH_FPP_UNI_N"
+ },
+ "classOfServiceIdentifierEvc": {
+ "type": "object",
+ "properties": {
+ "evc": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "classOfServiceIdentifierPcp": {
+ "type": "object",
+ "properties": {
+ "cosId": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "classOfServiceIdentifierIp": {
+ "type": "object",
+ "properties": {
+ "ipv4": {
+ "type": "string"
+ },
+ "ipv6": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "classOfServiceIdentifierL2CP": {
+ "type": "object",
+ "properties": {
+ "L2cpEvcGrpEntry": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "classOfServiceIdentifierSOAM": {
+ "type": "object",
+ "properties": {
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "colorIdentifier": {
+ "type": "object",
+ "properties": {
+ "colorIdentifierBasedOnEvc": {
+ "type": "object",
+ "properties": {
+ "evcId": {
+ "type": "string"
+ },
+ "color": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "egressEquivalenceClassIdentifierEvc": {
+ "type": "object",
+ "properties": {
+ "evc": {
+ "type": "string"
+ },
+ "egressEquivalenceClass": {
+ "type": "string"
+ }
+ }
+ },
+ "egressEquivalenceClassIdentifierCos": {
+ "type": "object",
+ "properties": {
+ "cosId": {
+ "type": "string"
+ },
+ "egressEquivalenceClass": {
+ "type": "string"
+ }
+ }
+ },
+ "egressEquivalenceClassIdentifierIp": {
+ "type": "object",
+ "properties": {
+ "ipv4": {
+ "type": "string"
+ },
+ "ipv6": {
+ "type": "string"
+ },
+ "egressEquivalenceClass": {
+ "type": "string"
+ }
+ }
+ },
+ "egressEquivalenceClassIdentifierL2CP": {
+ "type": "object",
+ "properties": {
+ "L2cpEvcGrpEntry": {
+ "type": "string"
+ },
+ "egressEquivalenceClass": {
+ "type": "string"
+ }
+ }
+ },
+ "egressEquivalenceClassIdentifierSOAM": {
+ "type": "object",
+ "properties": {
+ "egressEquivalenceClass": {
+ "type": "string"
+ }
+ }
+ },
+ "ingressBandwidthProfilePerEvc": {
+ "type": "object",
+ "properties": {
+ "envelopeId": {
+ "type": "string"
+ },
+ "rank": {
+ "type": "string"
+ },
+ "bwpCfgEirMax": {
+ "type": "integer"
+ },
+ "bwpCfgIdentifier": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCirMax": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "ingressBandwidthProfilePerClassOfServiceIdentifier": {
+ "type": "object",
+ "properties": {
+ "envelopeId": {
+ "type": "string"
+ },
+ "rank": {
+ "type": "string"
+ },
+ "bwpCfgEirMax": {
+ "type": "integer"
+ },
+ "bwpCfgIdentifier": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCirMax": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "BwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ },
+ "coS": {
+ "type": "string"
+ }
+ }
+ },
+ "egressBandwidthProfilePerEvc": {
+ "type": "object",
+ "properties": {
+ "envelopeId": {
+ "type": "string"
+ },
+ "rank": {
+ "type": "string"
+ },
+ "bwpCfgEirMax": {
+ "type": "integer"
+ },
+ "bwpCfgIdentifier": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCirMax": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "egressBandwidthProfilePerEgressEquivalenceClassIdentifier": {
+ "type": "object",
+ "properties": {
+ "envelopeId": {
+ "type": "string"
+ },
+ "rank": {
+ "type": "string"
+ },
+ "bwpCfgEirMax": {
+ "type": "integer"
+ },
+ "bwpCfgIdentifier": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCirMax": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ },
+ "coS": {
+ "type": "string"
+ }
+ }
+ },
+ "sourceMacAddressLimit": {
+ "type": "string"
+ },
+ "sourceMacAddressLimitN": {
+ "type": "integer"
+ },
+ "sourceMacAddressLimitT": {
+ "type": "integer"
+ },
+ "testMeg": {
+ "type": "string"
+ },
+ "subscriberMegMip": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "evcPerUniCfgIdentifier",
+ "classOfServiceIdentifierEvc",
+ "classOfServiceIdentifierPcp",
+ "classOfServiceIdentifierIp",
+ "classOfServiceIdentifierL2CP",
+ "classOfServiceIdentifierSOAM",
+ "colorIdentifier",
+ "egressEquivalenceClassIdentifierEvc",
+ "egressEquivalenceClassIdentifierCos",
+ "egressEquivalenceClassIdentifierIp",
+ "egressEquivalenceClassIdentifierL2CP",
+ "egressEquivalenceClassIdentifierSOAM",
+ "ingressBandwidthProfilePerEvc",
+ "ingressBandwidthProfilePerClassOfServiceIdentifier",
+ "egressBandwidthProfilePerEvc",
+ "egressBandwidthProfilePerEgressEquivalenceClassIdentifier",
+ "sourceMacAddressLimit",
+ "sourceMacAddressLimitN",
+ "sourceMacAddressLimitT",
+ "testMeg",
+ "subscriberMegMip"
+ ]
+ },
+ "SCA_ETH_IVC_End_Point": {
+ "type": "object",
+ "properties": {
+ "interfaceDescription": {
+ "type": "string"
+ },
+ "scaEthFppInniN": {
+ "type": "object",
+ "$ref": "#\/definitions\/SCA_ETH_FPP_INNI_N"
+ },
+ "stag": {
+ "type": "string"
+ },
+ "tpid": {
+ "type": "string"
+ },
+ "mtu": {
+ "type": "string"
+ },
+ "speed": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "interfaceDescription",
+ "stag",
+ "tpid",
+ "mtu",
+ "speed"
+ ]
+ },
+ "SCA_ETH_FPP_UNI_N": {
+ "type": "object",
+ "properties": {
+ "transportPort": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ },
+ "CLLI": {
+ "type": "string"
+ },
+ "Vendor": {
+ "type": "string"
+ },
+ "Hostname": {
+ "type": "string"
+ },
+ "Shelf": {
+ "type": "string"
+ },
+ "Slot": {
+ "type": "string"
+ },
+ "Subslot": {
+ "type": "string"
+ },
+ "Port": {
+ "type": "string"
+ },
+ "Rack": {
+ "type": "string"
+ },
+ "RemoteUnit": {
+ "type": "string"
+ },
+ "RemoteUnitSlot": {
+ "type": "string"
+ },
+ "RemoteUnitPort": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "CLLI",
+ "Hostname",
+ "Port"
+ ]
+ },
+ "interfaceCfgIdentifier": {
+ "description": "MEF 10.3 Section 9.1 UNI ID Service attribute",
+ "type": "string"
+ },
+ "physicalLayer": {
+ "description": "MEF 10.3, Section 9.2 Physical Layer Service attribute",
+ "type": "string"
+ },
+ "physicalLayerDuplexMode": {
+ "description": "MEF 10.3, Section 9.2 Physical Layer Service attribute Duplex Mode",
+ "type": "string"
+ },
+ "synchronousMode": {
+ "description": "MEF 10.3, Section 9.3 Synchronous Mode Service Attribute",
+ "type": "string"
+ },
+ "numberOfLinks": {
+ "description": "MEF 10.3, Section 9.4 Number of Links Service Attribute",
+ "type": "integer"
+ },
+ "uniResiliency": {
+ "description": "MEF 10.3, Section 9.5 UNI Resiliency Service Attribute",
+ "type": "string"
+ },
+ "frameFormat": {
+ "type": "string"
+ },
+ "uniMaximumServiceFrameSize": {
+ "type": "integer"
+ },
+ "multiplexing": {
+ "type": "string"
+ },
+ "uniCfgCeVidUntagged": {
+ "type": "integer"
+ },
+ "uniCfgCePriorityUntagged": {
+ "type": "integer"
+ },
+ "ceVlanId": {
+ "type": "string"
+ },
+ "evcId": {
+ "type": "string"
+ },
+ "interfaceStatusMaxVc": {
+ "type": "integer"
+ },
+ "bundling": {
+ "type": "string"
+ },
+ "allToOneBundling": {
+ "type": "string"
+ },
+ "interfaceCfgIngressBwp": {
+ "type": "object",
+ "properties": {
+ "envelopeId": {
+ "type": "string"
+ },
+ "rank": {
+ "type": "string"
+ },
+ "bwpCfgEirMax": {
+ "type": "integer"
+ },
+ "bwpCfgIdentifier": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCirMax": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "interfaceCfgEgressBwp": {
+ "type": "object",
+ "properties": {
+ "envelopeId": {
+ "type": "string"
+ },
+ "rank": {
+ "type": "string"
+ },
+ "bwpCfgEirMax": {
+ "type": "integer"
+ },
+ "bwpCfgIdentifier": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCirMax": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "BwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "BwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "linkOam": {
+ "type": "string"
+ },
+ "uniMeg": {
+ "type": "string"
+ },
+ "eLMI": {
+ "type": "string"
+ },
+ "uniL2cpServiceAttributes": {
+ "type": "object",
+ "properties": {
+ "uniL2cpPeering": {
+ "type": "object",
+ "properties": {
+ "protocolToBePeered": {
+ "type": "string"
+ },
+ "protocolIdentifier": {
+ "type": "object",
+ "properties": {
+ "Ethertype": {
+ "type": "string"
+ },
+ "Subtypes": {
+ "type": "string"
+ }
+ }
+ },
+ "l2cpDestinationAddress": {
+ "type": "string"
+ },
+ "linkIdentifier": {
+ "type": "string"
+ }
+ }
+ },
+ "unilL2cpAddressSet": {
+ "type": "object",
+ "properties": {
+ "l2cpDestinationAddress": {
+ "type": "string"
+ },
+ "assignment8021Q": {
+ "type": "string"
+ },
+ "filteredBy": {
+ "type": "object",
+ "properties": {
+ "CTA": {
+ "type": "boolean"
+ },
+ "CTB": {
+ "type": "boolean"
+ },
+ "CTB2": {
+ "type": "boolean"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "ethOvcEndPoint": {
+ "type": "object",
+ "properties": {
+ "ovcEndPtPerUniCfgIdentifier": {
+ "type": "string"
+ },
+ "ovcEndPtPerUniCfgCeVlanMap": {
+ "type": "object",
+ "properties": {
+ "CeVlanId": {
+ "type": "string"
+ },
+ "EvcId": {
+ "type": "string"
+ }
+ }
+ },
+ "ovcEndPtPerUniCfgRole": {
+ "type": "string"
+ },
+ "cosCfgOvcEp": {
+ "type": "object",
+ "properties": {
+ "ovc": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "cosCfgPcp": {
+ "type": "object",
+ "properties": {
+ "cosId": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "cosCfgDscp": {
+ "type": "object",
+ "properties": {
+ "ipv4": {
+ "type": "string"
+ },
+ "ipv6": {
+ "type": "string"
+ },
+ "classOfServiceName": {
+ "type": "string"
+ }
+ }
+ },
+ "ovcEndPtPerUniCfgIngressBwp": {
+ "type": "object",
+ "properties": {
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "ovcEndPtPerCosCfgIngressBwp": {
+ "type": "object",
+ "properties": {
+ "cosId": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "ovcEndPtPerUniCfgEgressBwp": {
+ "type": "object",
+ "properties": {
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ },
+ "ovcEndPtPerCosCfgEgressBwp": {
+ "type": "object",
+ "properties": {
+ "cosId": {
+ "type": "string"
+ },
+ "bwpCfgCir": {
+ "type": "integer"
+ },
+ "bwpCfgCbs": {
+ "type": "integer"
+ },
+ "bwpCfgEir": {
+ "type": "integer"
+ },
+ "bwpCfgEbs": {
+ "type": "integer"
+ },
+ "bwpCfgCm": {
+ "type": "string"
+ },
+ "bwpCfgCf": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "transportPort",
+ "interfaceCfgIdentifier"
+ ]
+ },
+ "SCA_ETH_FPP_INNI_N": {
+ "type": "object",
+ "properties": {
+ "transport": {
+ "type": "object",
+ "properties": {
+ "CLLI": {
+ "type": "string"
+ },
+ "Vendor": {
+ "type": "string"
+ },
+ "Hostname": {
+ "type": "string"
+ },
+ "Shelf": {
+ "type": "string"
+ },
+ "Slot": {
+ "type": "string"
+ },
+ "Subslot": {
+ "type": "string"
+ },
+ "Port": {
+ "type": "string"
+ },
+ "Rack": {
+ "type": "string"
+ },
+ "RemoteUnit": {
+ "type": "string"
+ },
+ "RemoteUnitSlot": {
+ "type": "string"
+ },
+ "RemoteUnitPort": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "CLLI",
+ "Hostname",
+ "Port"
+ ]
+ },
+ "interfaceDescription": {
+ "type": "string"
+ },
+ "mtu": {
+ "type": "string"
+ },
+ "speed": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "transport",
+ "interfaceDescription",
+ "mtu",
+ "speed"
+ ]
+ },
+ "SCA_ETH_Flow_Domain": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "SCA_ETH_FDFr_EC": {
+ "description": "List of SCA_ETH_FDFr_EC objects",
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_FDFr_EC"
+ }
+ },
+ "SCA_ETH_FPP_Link": {
+ "description": "List of SCA_ETH_FPP_Link objects",
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_FPP_Link"
+ }
+ }
+ }
+ },
+ "SCA_ETH_FPP_Link": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "SCA_ETH_FDFr_EC": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "flowDomainId": {
+ "type": "string"
+ },
+ "state": {
+ "description": "state of SCA_ETH_FDFr_EC",
+ "type": "string",
+ "enum": [
+ "active",
+ "inactive"
+ ]
+ },
+ "evcServiceType": {
+ "description": "MEF 10.3, Section 8.1",
+ "type": "string",
+ "enum": [
+ "Point_To_Point",
+ "Multipoint_To_Multipoint",
+ "Root_Multipoint"
+ ]
+ },
+ "evcCfgIdentifier": {
+ "description": "MEF 10.3, Section 8.2",
+ "type": "string"
+ },
+ "evcStatusMaxNumUni": {
+ "description": "MEF 10.3, Section 8.4",
+ "type": "integer"
+ },
+ "evcCfgMtuSize": {
+ "description": "MEF 10.3, Section 8.9",
+ "type": "integer"
+ },
+ "evcCfgCeVlanIdPreservation": {
+ "description": "MEF 10.3, Section 8.6.1",
+ "type": "string",
+ "enum": [
+ "Enabled",
+ "Disabled"
+ ]
+ },
+ "evcCfgCeVlanCosPreservation": {
+ "description": "MEF 10.3, Section 8.6.2",
+ "type": "string",
+ "enum": [
+ "Enabled",
+ "Disabled"
+ ]
+ },
+ "SCA_ETH_Flow_Points": {
+ "description": "List of SCA_ETH_Flow_Point objects",
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_Flow_Point"
+ }
+ },
+ "SCA_ETH_IVC_End_Points": {
+ "description": "List of SCA_ETH_IVC_End_Point objects",
+ "type": "array",
+ "items": {
+ "$ref": "#\/definitions\/SCA_ETH_IVC_End_Point"
+ }
+ }
+ }
+ },
+ "SCA_Error_Response": {
+ "description": "SCA Error addition information",
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
+
diff --git a/mef-sca-api/src/main/webapp/WEB-INF/web.xml b/mef-sca-api/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..673644b
--- /dev/null
+++ b/mef-sca-api/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="ONOS" version="2.5">
+ <display-name>MEF SCA REST API v1.0</display-name>
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Secured</web-resource-name>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>admin</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <security-role>
+ <role-name>admin</role-name>
+ </security-role>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>karaf</realm-name>
+ </login-config>
+
+ <servlet>
+ <servlet-name>JAX-RS MEF SCA Service</servlet-name>
+ <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <!-- Change for MEF SCA API -->
+ <param-value>org.onosproject.mefscaapi.MefScaApiWebApplication</param-value>
+ <!-- End of change for MEF SCA API -->
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Change for MEF SCA API -->
+ <servlet-mapping>
+ <servlet-name>JAX-RS MEF SCA Service</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+ <!-- End of change for MEF SCA API -->
+</web-app>
diff --git a/mef-sca-api/swaggergen/template/README b/mef-sca-api/swaggergen/template/README
new file mode 100644
index 0000000..3f59280
--- /dev/null
+++ b/mef-sca-api/swaggergen/template/README
@@ -0,0 +1,7 @@
+Workaround until swagger-code-gen 2.2.2 is released.
+
+Bug report:
+ https://github.com/swagger-api/swagger-codegen/issues/3509
+
+This directory and templateDirectory, additional-properties in pom.xml,
+can be removed after migrating to 2.2.2.
diff --git a/mef-sca-api/swaggergen/template/enumClass.mustache b/mef-sca-api/swaggergen/template/enumClass.mustache
new file mode 100644
index 0000000..c5c3143
--- /dev/null
+++ b/mef-sca-api/swaggergen/template/enumClass.mustache
@@ -0,0 +1,44 @@
+ /**
+ * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
+ */
+ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
+ {{#gson}}
+ {{#allowableValues}}
+ {{#enumVars}}
+ @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
+ {{{name}}}({{{value}}}){{^-last}},
+ {{/-last}}{{#-last}};{{/-last}}
+ {{/enumVars}}
+ {{/allowableValues}}
+ {{/gson}}
+ {{^gson}}
+ {{#allowableValues}}
+ {{#enumVars}}
+ {{{name}}}({{{value}}}){{^-last}},
+ {{/-last}}{{#-last}};{{/-last}}
+ {{/enumVars}}
+ {{/allowableValues}}
+ {{/gson}}
+
+ private {{{datatype}}} value;
+
+ {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{datatype}}} value) {
+ this.value = value;
+ }
+
+ @Override
+ @JsonValue
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
+ for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+ }
diff --git a/mef-sca-api/swaggergen/template/enumOuterClass.mustache b/mef-sca-api/swaggergen/template/enumOuterClass.mustache
new file mode 100644
index 0000000..76c2cbf
--- /dev/null
+++ b/mef-sca-api/swaggergen/template/enumOuterClass.mustache
@@ -0,0 +1,42 @@
+{{#jackson}}
+import com.fasterxml.jackson.annotation.JsonCreator;
+{{/jackson}}
+
+/**
+ * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
+ */
+public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
+ {{#gson}}
+ {{#allowableValues}}{{#enumVars}}
+ @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
+ {{{name}}}({{{value}}}){{^-last}},
+ {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
+ {{/gson}}
+ {{^gson}}
+ {{#allowableValues}}{{#enumVars}}
+ {{{name}}}({{{value}}}){{^-last}},
+ {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
+ {{/gson}}
+
+ private {{{dataType}}} value;
+
+ {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) {
+ this.value = value;
+ }
+
+ @Override
+ @JsonValue
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
+ for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+}
diff --git a/mef-sca-api/swaggergen/template/pojo.mustache b/mef-sca-api/swaggergen/template/pojo.mustache
new file mode 100644
index 0000000..489dd2a
--- /dev/null
+++ b/mef-sca-api/swaggergen/template/pojo.mustache
@@ -0,0 +1,150 @@
+/**
+ * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
+ */{{#description}}
+@ApiModel(description = "{{{description}}}"){{/description}}
+{{>generatedAnnotation}}
+public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
+ {{#vars}}
+ {{#isEnum}}
+ {{^isContainer}}
+{{>enumClass}}
+ {{/isContainer}}
+ {{/isEnum}}
+ {{#items.isEnum}}
+ {{#items}}
+ {{^isContainer}}
+{{>enumClass}}
+ {{/isContainer}}
+ {{/items}}
+ {{/items.isEnum}}
+ {{#jackson}}
+ @JsonProperty("{{baseName}}")
+ {{/jackson}}
+ {{#gson}}
+ @SerializedName("{{baseName}}")
+ {{/gson}}
+ private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
+
+ {{/vars}}
+ {{#vars}}
+ {{^isReadOnly}}
+ public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
+ this.{{name}} = {{name}};
+ return this;
+ }
+ {{#isListContainer}}
+
+ public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
+ this.{{name}}.add({{name}}Item);
+ return this;
+ }
+ {{/isListContainer}}
+ {{#isMapContainer}}
+
+ public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
+ this.{{name}}.put(key, {{name}}Item);
+ return this;
+ }
+ {{/isMapContainer}}
+
+ {{/isReadOnly}}
+ /**
+ {{#description}}
+ * {{{description}}}
+ {{/description}}
+ {{^description}}
+ * Get {{name}}
+ {{/description}}
+ {{#minimum}}
+ * minimum: {{minimum}}
+ {{/minimum}}
+ {{#maximum}}
+ * maximum: {{maximum}}
+ {{/maximum}}
+ * @return {{name}}
+ **/
+ {{#vendorExtensions.extraAnnotation}}
+ {{vendorExtensions.extraAnnotation}}
+ {{/vendorExtensions.extraAnnotation}}
+ {{#jackson}}
+ @JsonProperty("{{baseName}}")
+ {{/jackson}}
+ @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
+ public {{{datatypeWithEnum}}} {{getter}}() {
+ return {{name}};
+ }
+ {{^isReadOnly}}
+
+ public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
+ this.{{name}} = {{name}};
+ }
+ {{/isReadOnly}}
+
+ {{/vars}}
+
+{{^supportJava6}}
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }{{#hasVars}}
+ {{classname}} {{classVarName}} = ({{classname}}) o;
+ return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
+ {{/hasMore}}{{/vars}}{{#parent}} &&
+ super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
+ return true;{{/hasVars}}
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
+ }
+
+{{/supportJava6}}
+{{#supportJava6}}
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }{{#hasVars}}
+ {{classname}} {{classVarName}} = ({{classname}}) o;
+ return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
+ {{/hasMore}}{{/vars}}{{#parent}} &&
+ super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
+ return true;{{/hasVars}}
+ }
+
+ @Override
+ public int hashCode() {
+ return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
+ }
+
+{{/supportJava6}}
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class {{classname}} {\n");
+ {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
+ {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
+ {{/vars}}sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}