Initial development of Carrier Ethernet E-CORD
Change-Id: I57ca86dc1dd6a19636f3778d6f5030df33169144
diff --git a/local/http-channel/pom.xml b/local/http-channel/pom.xml
new file mode 100644
index 0000000..e6a367e
--- /dev/null
+++ b/local/http-channel/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2015-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.
+ -->
+<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.opencord.ce</groupId>
+ <artifactId>local</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>local-channel</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>Http communication channel between hierarchic ONOS controllers</description>
+
+ <properties>
+ <onos.app.name>org.opencord.ce.local.channel.http</onos.app.name>
+ <web.context>/ecord</web.context>
+ <onos.app.title>ECORD-CE App</onos.app.title>
+ <onos.app.url>http://opencord.org</onos.app.url>
+ <project.version>1.0.0</project.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opencord.ce</groupId>
+ <artifactId>bigswitch</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_wab>src/main/webapp/</_wab>
+ <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.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <releases><enabled>false</enabled></releases>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <releases><enabled>false</enabled></releases>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
\ No newline at end of file
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java
new file mode 100644
index 0000000..a98365b
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.client;
+
+import com.google.common.collect.Sets;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.domain.DomainId;
+import org.opencord.ce.api.services.channel.EndPoint;
+
+import java.util.Set;
+
+/**
+ * Configuration class for this bundle.
+ * Currently this configuration is simply the connection endpoint of the global ONOS.
+ *
+ * Look at config-samples/ecord-local-config.json for a sample configuration
+ */
+public class ConnectionConfig extends Config<ApplicationId> {
+
+ private static final String PORT = "port";
+ private static final String DOMAIN_IPS = "clusterIps";
+ private static final String USERNAME = "username";
+ private static final String PASSWD = "password";
+ private static final String TOPIC = "topic";
+
+ public EndPoint global() {
+ Set<IpAddress> ipAddresses = Sets.newHashSet();
+ object.path(DOMAIN_IPS).forEach(ipAddress -> ipAddresses.add(
+ IpAddress.valueOf(ipAddress.asText())
+ ));
+ int port = object.path(PORT).asInt();
+
+ String username = object.path(USERNAME).asText();
+ String password = object.path(PASSWD).asText();
+
+ String topic = object.path(TOPIC).asText();
+
+ return new EndPoint(DomainId.domainId("global"), ipAddresses, port,
+ username, password, topic);
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java
new file mode 100644
index 0000000..e93625a
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.client;
+
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.jboss.netty.util.Timeout;
+import org.jboss.netty.util.TimerTask;
+import org.onlab.packet.IpAddress;
+import org.onlab.util.Timer;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.slf4j.Logger;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.opencord.ce.api.services.channel.Symbols.BASE_URL;
+import static org.opencord.ce.api.services.channel.Symbols.COLON;
+import static org.opencord.ce.api.services.channel.Symbols.DOUBLESLASH;
+import static org.opencord.ce.api.services.channel.Symbols.HTTP;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_IP;
+import static org.opencord.ce.api.services.channel.Symbols.OK;
+import static org.opencord.ce.api.services.channel.Symbols.RESULT;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Executed periodically to find the leader node of a domain.
+ * Stops when the ip is found
+ */
+public class DomainMasterIpDiscoveryTask implements TimerTask {
+
+ private final Logger log = getLogger(getClass());
+
+ private Timeout timeout;
+ private volatile boolean isStopped;
+ private EndPoint endPoint;
+ private Client client;
+ private String localSiteId;
+
+ private ObjectMapper mapper;
+
+ public DomainMasterIpDiscoveryTask(EndPoint endPoint, Client client,
+ ObjectMapper mapper, String localSiteId) {
+ this.endPoint = endPoint;
+ this.client = client;
+ this.mapper = mapper;
+ this.localSiteId = localSiteId;
+
+ isStopped = true;
+ start();
+
+ }
+
+ public synchronized void stop() {
+ if (!isStopped) {
+ isStopped = true;
+ timeout.cancel();
+ } else {
+ log.warn("IpDiscovery stopped multiple times?");
+ }
+ }
+
+ public synchronized void start() {
+ if (isStopped) {
+ isStopped = false;
+ timeout = Timer.getTimer().newTimeout(this, 0, SECONDS);
+ } else {
+ log.warn("IpDiscovery started multiple times?");
+ }
+ }
+
+ public synchronized boolean isStopped() {
+ return isStopped || timeout.isCancelled();
+ }
+
+ @Override
+ public void run(Timeout t) {
+ if (isStopped()) {
+ return;
+ }
+ for (IpAddress ipAddress : endPoint.ipAddresses()) {
+ String url = HTTP + COLON + DOUBLESLASH + ipAddress.toString() + COLON +
+ endPoint.port() + BASE_URL + "/global" + MASTER + "/" + localSiteId;
+ log.info("GET: " + url);
+ WebTarget wt = client.target(url);
+ Response response = wt.request(MediaType.APPLICATION_JSON)
+ .get();
+ log.info("DEBUG response: " + response.toString());
+ if (response.getStatus() != Response.Status.OK.getStatusCode()) {
+
+ continue;
+ }
+ String stringBody = response.readEntity(String.class);
+ try {
+ ObjectNode responseBody = (ObjectNode) mapper.readTree(stringBody);
+ if (responseBody.path(RESULT).asText().equals(OK)) {
+ IpAddress masterIpAdress = IpAddress.valueOf(responseBody.path(MASTER_IP).asText());
+ HttpClientInstance.INSTANCE.setMasterIp(endPoint, masterIpAdress);
+ this.stop();
+ return;
+ }
+ } catch (IOException ex) {
+ log.info("getLocalMasterIp() IOException, try next endpoint ip");
+ }
+ }
+
+ if (!isStopped()) {
+ timeout = Timer.getTimer().newTimeout(this, 3, SECONDS);
+ }
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java
new file mode 100644
index 0000000..99f0d3c
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.client;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.basics.SubjectFactories;
+import org.onosproject.net.device.PortDescription;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.opencord.ce.local.bigswitch.BigSwitchEvent;
+import org.opencord.ce.local.bigswitch.BigSwitchListener;
+import org.opencord.ce.local.bigswitch.BigSwitchService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * Component that reacts to the BigSwitch events by notifying the global ONOS orchestrator.
+ */
+// TODO: better name
+@Component(immediate = true)
+public class HttpClientComponent {
+ private static final String APP_NAME = "org.opencord.ce.local.channel.http";
+
+ // temporary
+ private static final String TOPIC_ONE = "ecord-domains-topic-one";
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+ private ApplicationId appId;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected ClusterService clusterService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected LeadershipService leadershipService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected NetworkConfigRegistry configRegistry;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected NetworkConfigService configService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected CoreService coreService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected BigSwitchService bigSwitchService;
+
+ private EndPoint globalOnos;
+
+ private final ExecutorService eventExecutor =
+ Executors.newSingleThreadExecutor();
+
+ private final ConfigFactory<ApplicationId, ConnectionConfig> configFactory =
+ new ConfigFactory<ApplicationId, ConnectionConfig>(SubjectFactories.APP_SUBJECT_FACTORY,
+ ConnectionConfig.class, "global") {
+ @Override
+ public ConnectionConfig createConfig() {
+ return new ConnectionConfig();
+ }
+ };
+
+ private final NetworkConfigListener configListener = new InternalConfigListener();
+ private final BigSwitchListener bigSwitchListener = new InternalBigSwitchListener();
+
+ @Activate
+ public void activate() {
+ log.info("Started");
+
+ appId = coreService.registerApplication(APP_NAME);
+ leadershipService.runForLeadership(TOPIC_ONE);
+ configRegistry.registerConfigFactory(configFactory);
+ configService.addListener(configListener);
+ bigSwitchService.addListener(bigSwitchListener);
+ HttpClientInstance.INSTANCE.configure(clusterService, leadershipService);
+ }
+
+ @Deactivate
+ public void deactivate() {
+ log.info("Stopped");
+
+ leadershipService.withdraw(TOPIC_ONE);
+ bigSwitchService.removeListener(bigSwitchListener);
+ configService.removeListener(configListener);
+ configRegistry.unregisterConfigFactory(configFactory);
+ HttpClientInstance.INSTANCE.stopNetworkTasks();
+ }
+
+ private void readConfig() {
+ globalOnos = configRegistry.getConfig(appId, ConnectionConfig.class)
+ .global();
+ if (globalOnos == null) {
+ log.error("Configuration failure");
+ return;
+ }
+ HttpClientInstance.INSTANCE.setGlobalOnos(globalOnos);
+ }
+
+ private class InternalBigSwitchListener implements BigSwitchListener {
+
+ @Override
+ public void event(BigSwitchEvent event) {
+ log.info(event.toString());
+ switch (event.type()) {
+ case DEVICE_CREATED:
+ log.info("DEBUG: DEV_CREATED event");
+ HttpClientInstance.INSTANCE.notifyBigSwitch();
+ case PORT_ADDED:
+ case PORT_UPDATED:
+ case PORT_REMOVED:
+ // the subject is port last updated / added port
+ // but we are not interested in it now
+ List<PortDescription> ports = event.allPorts();
+ HttpClientInstance.INSTANCE.notifyBigSwitchPorts(ports);
+ break;
+ case DEVICE_REMOVED:
+ // TODO
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ private class InternalConfigListener implements NetworkConfigListener {
+
+ @Override
+ public void event(NetworkConfigEvent event) {
+ if (!event.configClass().equals(ConnectionConfig.class)) {
+ return;
+ }
+ switch (event.type()) {
+ case CONFIG_ADDED:
+ log.info("Network configuration added");
+ eventExecutor.execute(HttpClientComponent.this::readConfig);
+ break;
+ case CONFIG_UPDATED:
+ log.info("Network configuration updated");
+ eventExecutor.execute(HttpClientComponent.this::readConfig);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java
new file mode 100644
index 0000000..0d831d9
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.client;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.ChassisId;
+import org.onlab.packet.IpAddress;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultDevice;
+import org.onosproject.net.DefaultPort;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.opencord.ce.api.services.channel.RequestCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.opencord.ce.api.services.channel.Symbols.BASE_URL;
+import static org.opencord.ce.api.services.channel.Symbols.COLON;
+import static org.opencord.ce.api.services.channel.Symbols.DELETE;
+import static org.opencord.ce.api.services.channel.Symbols.DOUBLESLASH;
+import static org.opencord.ce.api.services.channel.Symbols.GET;
+import static org.opencord.ce.api.services.channel.Symbols.HTTP;
+import static org.opencord.ce.api.services.channel.Symbols.POST;
+
+/**
+ * HTTP client instance used to communicate
+ * to the global ONOS events related to the big switch topology abstraction.
+ */
+public enum HttpClientInstance {
+ INSTANCE;
+ private final Logger log =
+ LoggerFactory.getLogger(HttpClientInstance.class);
+ private static final Object MONITOR = new Object();
+
+ private static final int STATUS_OK = Response.Status.OK.getStatusCode();
+ private static final int STATUS_REQ_UNPROCESSABLE = Response.Status.NOT_ACCEPTABLE.getStatusCode();
+
+ private final AbstractWebResource codecContext = new AbstractWebResource();
+ private final Client client = ClientBuilder.newClient();
+
+ private ClusterService clusterService;
+ private LeadershipService leadershipService;
+ private EndPoint globalOnos;
+ private IpAddress currentRemoteMasterIp;
+ private DomainMasterIpDiscoveryTask globalMasterIpDiscoveryTask;
+
+ private final ExecutorService networkExecutor =
+ newSingleThreadExecutor();
+
+ public void configure(ClusterService clusterService, LeadershipService leadershipService) {
+ this.clusterService = clusterService;
+ this.leadershipService = leadershipService;
+ }
+
+ protected void setGlobalOnos(EndPoint globalOnos) {
+ synchronized (MONITOR) {
+ this.globalOnos = globalOnos;
+ }
+ // TODO: add leadership listeners to react to changes
+ if (isLeader(globalOnos.topic())) {
+ globalMasterIpDiscoveryTask =
+ new DomainMasterIpDiscoveryTask(globalOnos, client, codecContext.mapper(),
+ clusterService.getLocalNode().id().id());
+ } else {
+ log.info("I am NOT the leader for the communication with the global");
+ }
+ }
+
+ protected void setMasterIp(EndPoint endPoint, IpAddress ipAddress) {
+ synchronized (MONITOR) {
+ currentRemoteMasterIp = ipAddress;
+ MONITOR.notify();
+ }
+ }
+
+ private boolean isLeader(String topic) {
+ return leadershipService.getLeader(topic).id()
+ .equals(clusterService.getLocalNode().id().id());
+ }
+
+ private boolean checkReply(Response response) {
+ if (response != null) {
+ return checkStatusCode(response.getStatus());
+ }
+ log.error("Null reply from end point");
+ return false;
+ }
+
+ private boolean checkStatusCode(int statusCode) {
+ if (statusCode == STATUS_OK) {
+ return true;
+ } else {
+ log.error("Failed request, HTTP error code : "
+ + statusCode);
+ return false;
+ }
+ }
+
+ public void stopNetworkTasks() {
+ globalMasterIpDiscoveryTask.stop();
+ }
+
+ public void notifyBigSwitch() {
+ String siteId = clusterService.getLocalNode().id().id();
+ String deviceId = "domain:" + siteId;
+ String resource = "/" + siteId + "/" + deviceId;
+ ObjectNode body = codecContext.mapper().createObjectNode();
+ // body is empty for now
+ networkExecutor.execute(new NetworkTask(POST, resource, body.toString(), new RequestCallback() {
+ @Override
+ public void onSuccess(Response response) {
+
+ }
+
+ @Override
+ public void onError(Response response) {
+
+ }
+ }));
+ }
+
+ public void notifyBigSwitchPorts(List<PortDescription> ports) {
+ String siteId = clusterService.getLocalNode().id().id();
+ JsonCodec<Port> portCodec = codecContext.codec(Port.class);
+ ArrayNode body = codecContext.mapper().createArrayNode();
+ DeviceId deviceId = DeviceId.deviceId("domain:" + siteId);
+ ports.forEach(portDescription ->
+ body.add(portCodec.encode(new DefaultPort(new DummyDevice(deviceId), portDescription.portNumber(),
+ portDescription.isEnabled(), portDescription.type(),
+ portDescription.portSpeed(), portDescription.annotations()), codecContext)));
+ String resource = "/" + siteId + "/" + deviceId + "/ports";
+ networkExecutor.execute(new NetworkTask(POST, resource, body.toString(), new RequestCallback() {
+ @Override
+ public void onSuccess(Response response) {
+
+ }
+
+ @Override
+ public void onError(Response response) {
+
+ }
+ }));
+
+ }
+
+ private class NetworkTask implements Runnable {
+ private String method;
+ private String resource;
+ private String body;
+ private RequestCallback callback;
+
+ NetworkTask(String method, String resource, String body,
+ RequestCallback callback) {
+ this.method = method;
+ this.resource = resource;
+ this.body = body;
+ this.callback = callback;
+ }
+ @Override
+ public void run() {
+ synchronized (MONITOR) {
+ while (globalOnos == null || currentRemoteMasterIp == null) {
+ try {
+ log.info("wait() global-ONOS endpoint");
+ MONITOR.wait();
+ } catch (InterruptedException ie) {
+ log.info("Interrupted exception: " + ie.getMessage());
+ }
+ }
+ }
+ String url = HTTP + COLON + DOUBLESLASH + currentRemoteMasterIp + COLON +
+ globalOnos.port() + BASE_URL + "/global/topology" + resource;
+
+ log.info("Sending data via http: url: {}\n body: {}", url, body);
+
+ WebTarget webTarget = client.target(url);
+ Response response;
+ switch (method) {
+ case POST:
+ response = webTarget.request(MediaType.APPLICATION_JSON)
+ .post(Entity.entity(body, MediaType.APPLICATION_JSON));
+ break;
+ case DELETE:
+ response = webTarget.request(MediaType.APPLICATION_JSON).delete();
+ break;
+ case GET:
+ default:
+ response = webTarget.request(MediaType.APPLICATION_JSON).get();
+ break;
+ }
+
+ if (!checkReply(response)) {
+ callback.onError(response);
+ } else {
+ callback.onSuccess(response);
+ }
+ }
+ }
+
+ /**
+ * Dummy Device which only holds DeviceId.
+ */
+ private static final class DummyDevice extends DefaultDevice {
+ /**
+ * Constructs Dummy Device which only holds DeviceId.
+ *
+ * @param did device Id
+ */
+ public DummyDevice(DeviceId did) {
+ super(new ProviderId(did.uri().getScheme(), "PortCodec"), did,
+ Type.SWITCH, "dummy", "0", "0", "0", new ChassisId(),
+ DefaultAnnotations.EMPTY);
+ }
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/TestTopology.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/TestTopology.java
new file mode 100644
index 0000000..725a3db
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/TestTopology.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.client;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.packet.ChassisId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.link.DefaultLinkDescription;
+import org.onosproject.net.link.LinkDescription;
+import org.onosproject.net.link.LinkProvider;
+import org.onosproject.net.link.LinkProviderRegistry;
+import org.onosproject.net.link.LinkProviderService;
+import org.onosproject.net.provider.ProviderId;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Inject fake topology elements.
+ */
+//@Component(immediate = true)
+public class TestTopology implements DeviceProvider,
+ LinkProvider {
+ public static final String PROVIDER_NAME = "org.opencord.ce.local.test";
+ public static final ProviderId PROVIDER_ID = new ProviderId("test", PROVIDER_NAME);
+ private static final String UNKNOWN = "unknown";
+
+ private final Logger log = getLogger(getClass());
+ public static final String TEST_DEV_PREFIX = "test:0000";
+ public static final int NUM = 1;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected CoreService coreService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected DeviceProviderRegistry deviceProviderRegistry;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected LinkProviderRegistry linkProviderRegistry;
+
+ protected DeviceProviderService deviceProviderService;
+ protected LinkProviderService linkProviderService;
+
+ @Override
+ public ProviderId id() {
+ return PROVIDER_ID;
+ }
+
+ @Activate
+ public void activate() {
+ coreService.registerApplication(PROVIDER_NAME);
+ deviceProviderService = deviceProviderRegistry.register(this);
+ linkProviderService = linkProviderRegistry.register(this);
+
+ new Thread(this::buildFakeNetwork).start();
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ deviceProviderRegistry.unregister(this);
+ linkProviderRegistry.unregister(this);
+ log.info("Stopped");
+ }
+
+ @Override
+ public void triggerProbe(DeviceId deviceId){
+
+ }
+
+ @Override
+ public void roleChanged(DeviceId deviceId, MastershipRole newRole) {
+
+ }
+
+ @Override
+ public boolean isReachable(DeviceId deviceId) {
+ return true;
+ }
+
+ @Override
+ public void changePortState(DeviceId deviceId, PortNumber portNumber,
+ boolean enable) {
+
+ }
+
+ private void buildFakeNetwork() {
+ ChassisId chassisId = new ChassisId();
+ SparseAnnotations annotations = DefaultAnnotations.builder()
+ .set("no-lldp", "any")
+ .set("test", "test")
+ .build();
+ int i;
+ int j;
+ for (i = 1; i <= NUM; i++) {
+ DeviceId deviceId = DeviceId.deviceId(TEST_DEV_PREFIX + i);
+ DeviceDescription deviceDescription = new DefaultDeviceDescription(
+ deviceId.uri(),
+ Device.Type.SWITCH,
+ UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+ chassisId, annotations);
+ deviceProviderService.deviceConnected(deviceId, deviceDescription);
+ List<PortDescription> ports = new ArrayList<>();
+ for (j = 1; j <= NUM; j++) {
+ ports.add(new DefaultPortDescription(PortNumber.portNumber(j),
+ true, Port.Type.FIBER, 10000,
+ annotations));
+
+ }
+ deviceProviderService.updatePorts(deviceId, ports);
+
+ String macString = randomMCAddress();
+ log.info("MacString: {}", macString);
+/*
+ HostDescription hostDescription = new DefaultHostDescription(MacAddress.valueOf(macString),
+ VlanId.NONE,
+ new HostLocation(deviceId, PortNumber.portNumber(1), 0),
+ annotations);
+ hostProviderService.hostDetected(hostId, hostDescription, true);
+ */
+ }
+
+ long seed = (long) ThreadLocalRandom.current().nextDouble();
+ Random rand = new Random(seed);
+ for (i = 1; i <= NUM; i++) {
+ for (j = i + 1; j <= NUM; j++) {
+
+
+ if (rand.nextDouble() > 0.5) {
+ continue;
+ }
+
+ LinkDescription linkDescription = new DefaultLinkDescription(
+ ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + i + "/" + j),
+ ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + j + "/" + (i + 1)),
+ Link.Type.DIRECT,
+ true,
+ annotations
+ );
+ LinkDescription linkDescription1 = new DefaultLinkDescription(
+ ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + j + "/" + (i + 1)),
+ ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + i + "/" + j),
+ Link.Type.DIRECT,
+ true,
+ annotations
+ );
+ linkProviderService.linkDetected(linkDescription);
+ linkProviderService.linkDetected(linkDescription1);
+ }
+ }
+ }
+ private String randomMCAddress() {
+ Random rand = new Random();
+ byte[] macAddr = new byte[6];
+ rand.nextBytes(macAddr);
+
+ macAddr[0] = (byte) (macAddr[0] & (byte) 254); //zeroing last 2
+ // bytes to make it unicast and locally adminstrated
+ StringBuilder sb = new StringBuilder(18);
+ for (byte b : macAddr) {
+
+ if (sb.length() > 0) {
+ sb.append(":");
+ }
+ sb.append(String.format("%02x", b));
+ }
+ return sb.toString();
+ }
+
+
+
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/package-info.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/package-info.java
new file mode 100644
index 0000000..93ee03f
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-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.
+ */
+
+/**
+ * Implementation of the client-side communication channel APIs.
+ */
+package org.opencord.ce.local.channel.client;
\ No newline at end of file
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/DomainMasterIpResource.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/DomainMasterIpResource.java
new file mode 100644
index 0000000..4f906c6
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/DomainMasterIpResource.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.server;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.IpAddress;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.rest.AbstractWebResource;
+import org.slf4j.Logger;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_API_NO_IP_BODY;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_IP;
+import static org.opencord.ce.api.services.channel.Symbols.OK;
+import static org.opencord.ce.api.services.channel.Symbols.RESULT;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Gets the ip of the instance leader of the communication with the specified
+ * domainId.
+ */
+@Path("master")
+public class DomainMasterIpResource extends AbstractWebResource {
+ private final Logger log = getLogger(getClass());
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getMasterIp() {
+ log.info("Global domain asks who is the master for him");
+
+ //IpAddress ip = get(ConnectionService.class).getLocalMasterIp(id);
+
+ // testing
+ IpAddress ip = get(ClusterService.class).getLocalNode().ip();
+ if (ip != null) {
+ ObjectNode body = mapper().createObjectNode();
+ body.put(RESULT, OK);
+ body.put(MASTER_IP, ip.toString());
+
+ return ok(body.toString()).build();
+ } else {
+ return ok(MASTER_API_NO_IP_BODY).build();
+ }
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java
new file mode 100644
index 0000000..810fa2d
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.server;
+
+import org.onlab.rest.AbstractWebApplication;
+
+import java.util.Set;
+
+
+/**
+ * Loader class for web resource APIs.
+ */
+public class EcordLocalRestApp extends AbstractWebApplication {
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ return getClasses(MetroNetworkResource.class, DomainMasterIpResource.class);
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/MetroNetworkResource.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/MetroNetworkResource.java
new file mode 100644
index 0000000..281315a
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/MetroNetworkResource.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2017-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.opencord.ce.local.channel.server;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+import org.slf4j.Logger;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Web resource for {@link MetroNetworkVirtualNodeService}
+ * APIs.
+ */
+@Path("carrierethernet")
+public class MetroNetworkResource extends AbstractWebResource {
+ private final Logger log = getLogger(getClass());
+ private static final String FC = "fc";
+ private static final String SRC_NI = "srcNi";
+ private static final String DST_NI_LIST = "dstNiList";
+ private static final String UNI = "uni";
+
+ private JsonCodec<CarrierEthernetForwardingConstruct> fcCodec =
+ codec(CarrierEthernetForwardingConstruct.class);
+ private JsonCodec<CarrierEthernetNetworkInterface> niCodec =
+ codec(CarrierEthernetNetworkInterface.class);
+
+ @Path("ForwardingConstruct")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @POST
+ public Response setNodeForwarding(InputStream stream) {
+ try {
+ JsonNode responseBody = mapper().readTree(stream);
+ log.info(responseBody.toString());
+ MetroNetworkVirtualNodeService localNodeService =
+ get(MetroNetworkVirtualNodeService.class);
+
+ CarrierEthernetForwardingConstruct fc =
+ fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+ CarrierEthernetNetworkInterface srcNi =
+ niCodec.decode((ObjectNode) responseBody.path(SRC_NI), this);
+ Set<CarrierEthernetNetworkInterface> dstNiSet = new HashSet<>();
+ responseBody.path(DST_NI_LIST).forEach(jsonDstNi ->
+ dstNiSet.add(niCodec.decode((ObjectNode) jsonDstNi, this)));
+
+ localNodeService.setNodeForwarding(fc, srcNi, dstNiSet);
+ return Response.status(200).build();
+ } catch (IOException io) {
+ log.info("Json parse error");
+ return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+ }
+ }
+
+ @Path("createBwp")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @POST
+ public Response createBandwidthProfileResources(InputStream stream) {
+ try {
+ MetroNetworkVirtualNodeService localNodeService =
+ get(MetroNetworkVirtualNodeService.class);
+
+ JsonNode responseBody = mapper().readTree(stream);
+ log.info(responseBody.toString());
+
+ CarrierEthernetForwardingConstruct fc =
+ fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+ CarrierEthernetUni uni = (CarrierEthernetUni)
+ niCodec.decode((ObjectNode) responseBody.path(UNI), this);
+ localNodeService.createBandwidthProfileResources(fc, uni);
+ return Response.status(200).build();
+ } catch (IOException io) {
+ log.info("Json parse error");
+ return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+ }
+ }
+
+ @Path("applyBwp")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @POST
+ public Response applyBandwidthProfileResources(InputStream stream) {
+ try {
+ MetroNetworkVirtualNodeService localNodeService =
+ get(MetroNetworkVirtualNodeService.class);
+
+ JsonNode responseBody = mapper().readTree(stream);
+ log.info(responseBody.toString());
+
+ CarrierEthernetForwardingConstruct fc =
+ fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+ CarrierEthernetUni uni = (CarrierEthernetUni)
+ niCodec.decode((ObjectNode) responseBody.path(UNI), this);
+
+ localNodeService.applyBandwidthProfileResources(fc, uni);
+ return Response.status(200).build();
+ } catch (IOException io) {
+ log.info("Json parse error");
+ return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+ }
+ }
+
+ @Path("deleteBwp")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @POST
+ public Response removeBandwidthProfileResources(InputStream stream) {
+ try {
+ MetroNetworkVirtualNodeService localNodeService =
+ get(MetroNetworkVirtualNodeService.class);
+
+ JsonNode responseBody = mapper().readTree(stream);
+ log.info(responseBody.toString());
+
+ CarrierEthernetForwardingConstruct fc =
+ fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+
+ CarrierEthernetUni uni = (CarrierEthernetUni)
+ niCodec.decode((ObjectNode) responseBody.path(UNI), this);
+
+ localNodeService.applyBandwidthProfileResources(fc, uni);
+ return Response.status(200).build();
+ } catch (IOException io) {
+ log.info("Json parse error");
+ return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+ }
+ }
+
+ @Path("deleteFcResources/{fcId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @GET
+ public Response removeAllForwardingResources(@PathParam("{fcId}") String fcId) {
+ EvcConnId evcId = EvcConnId.of(fcId);
+ MetroNetworkVirtualNodeService localNodeService =
+ get(MetroNetworkVirtualNodeService.class);
+
+ localNodeService.removeAllForwardingResources(evcId);
+ return Response.status(200).build();
+ }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/package-info.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/package-info.java
new file mode 100644
index 0000000..ab612ed
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-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.
+ */
+
+/**
+ * Implementation of the server-side communication channel APIs.
+ */
+package org.opencord.ce.local.channel.server;
\ No newline at end of file
diff --git a/local/http-channel/src/main/webapp/WEB-INF/web.xml b/local/http-channel/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..32cc06c
--- /dev/null
+++ b/local/http-channel/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<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>ICONA REST API v1.0</display-name>
+
+ <servlet>
+ <servlet-name>JAX-RS Service</servlet-name>
+ <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.opencord.ce.local.channel.server.EcordLocalRestApp</param-value>
+ </init-param>
+ <load-on-startup>10</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>JAX-RS Service</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>