From b31d270a05ea744ff8d539745e04738d836cf119 Mon Sep 17 00:00:00 2001 From: Reinaldo Penno Date: Tue, 27 Oct 2015 23:56:23 -0700 Subject: [PATCH] Bug 4544 - SFC-VNFM Interface Implementation Change-Id: I5b2c150df649e1a1ec1b484225754209d83dea29 Signed-off-by: Reinaldo Penno --- features-sfc-vnfm/pom.xml | 141 ++++ .../src/main/resources/features.xml | 26 + features/pom.xml | 708 +++++++++--------- pom.xml | 2 + sfc-vnfm/pom.xml | 170 +++++ .../config/sfc_vnfm/impl/SfcVnfmModule.java | 59 ++ .../sfc_vnfm/impl/SfcVnfmModuleFactory.java | 13 + .../sfc/sfc_vnfm/api/ServiceFunctionVnfm.java | 27 + .../provider/SfcVnfmDataProvider.java | 36 + .../initial/sfc-vnfm-initial.xml | 33 + sfc-vnfm/src/main/yang/sfc-vnfm-impl.yang | 53 ++ .../sfc_vnfm/provider/api/SfcVnfmAPITest.java | 30 + 12 files changed, 948 insertions(+), 350 deletions(-) create mode 100644 features-sfc-vnfm/pom.xml create mode 100644 features-sfc-vnfm/src/main/resources/features.xml create mode 100755 sfc-vnfm/pom.xml create mode 100644 sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModule.java create mode 100644 sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModuleFactory.java create mode 100644 sfc-vnfm/src/main/java/org/opendaylight/org/opendaylight/sfc/sfc_vnfm/api/ServiceFunctionVnfm.java create mode 100755 sfc-vnfm/src/main/java/org/opendaylight/sfc/sfc_vnfm/provider/SfcVnfmDataProvider.java create mode 100644 sfc-vnfm/src/main/resources/configuration/initial/sfc-vnfm-initial.xml create mode 100755 sfc-vnfm/src/main/yang/sfc-vnfm-impl.yang create mode 100755 sfc-vnfm/src/test/java/org/opendaylight/sfc/sfc_vnfm/provider/api/SfcVnfmAPITest.java diff --git a/features-sfc-vnfm/pom.xml b/features-sfc-vnfm/pom.xml new file mode 100644 index 000000000..a57355f6f --- /dev/null +++ b/features-sfc-vnfm/pom.xml @@ -0,0 +1,141 @@ + + + + + 4.0.0 + + sfc-parent + org.opendaylight.sfc + 0.2.0-SNAPSHOT + + features-sfc-vnfm + jar + + features.xml + + + + + org.opendaylight.sfc + features-sfc + ${project.version} + features + xml + + + org.opendaylight.odlparent + features-test + ${feature.test.version} + test + + + org.opendaylight.sfc + sfc-provider + ${project.version} + + + org.opendaylight.sfc + sfc-vnfm + ${project.version} + xml + config + + + org.opendaylight.sfc + sfc-vnfm + ${project.version} + + + org.opendaylight.controller.model + model-inventory + + + + org.opendaylight.controller + opendaylight-karaf-empty + ${karaf.empty.version} + zip + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + + + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + + filter + generate-resources + + resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.directory}/classes/${features.file} + xml + features + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.opendaylight.controller + opendaylight-karaf-empty + ${karaf.empty.version} + + + org.opendaylight.odlparent:features-test + + + + + + + scm:git:ssh://git.opendaylight.org:29418/sfc.git + scm:git:ssh://git.opendaylight.org:29418/sfc.git + HEAD + https://git.opendaylight.org/gerrit/gitweb?p=sfc.git;a=summary + + + diff --git a/features-sfc-vnfm/src/main/resources/features.xml b/features-sfc-vnfm/src/main/resources/features.xml new file mode 100644 index 000000000..746ffa079 --- /dev/null +++ b/features-sfc-vnfm/src/main/resources/features.xml @@ -0,0 +1,26 @@ + + + + + mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features + mvn:org.opendaylight.sfc/features-sfc/${project.version}/xml/features + + + odl-sfc-provider-rest + mvn:org.opendaylight.sfc/sfc-vnfm/${project.version} + + mvn:org.opendaylight.sfc/sfc-vnfm/${project.version}/xml/config + + + + + + diff --git a/features/pom.xml b/features/pom.xml index e99349f20..90fe6c71c 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -6,360 +6,368 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - - 4.0.0 - - sfc-parent - org.opendaylight.sfc - 0.2.0-SNAPSHOT - + + 4.0.0 + + sfc-parent + org.opendaylight.sfc + 0.2.0-SNAPSHOT + - features-sfc - jar - - features.xml - - - - + + + - - org.opendaylight.yangtools - features-yangtools - ${yangtools.version} - features - xml - - - org.opendaylight.controller - features-mdsal - features - xml - - - org.opendaylight.mdsal.model - features-mdsal-model - ${mdsal.model.version} - features - xml - runtime - - - org.opendaylight.netconf - features-restconf - ${restconf.version} - features - xml - - - org.opendaylight.netconf - features-netconf-connector - ${netconf.parent.version} - features - xml - runtime - - - org.opendaylight.ovsdb - southbound-features - ${ovsdb.southbound.version} - features - xml - runtime - - - org.opendaylight.l2switch - features-l2switch - ${l2switch.version} - features - xml - + Note: they will need to be xml + and features. + One other thing to watch for is to make sure they are + compile, which they should be by default, + but be cautious lest they be at a different scope in a parent pom. + --> + + org.opendaylight.yangtools + features-yangtools + ${yangtools.version} + features + xml + + + org.opendaylight.controller + features-mdsal + features + xml + + + org.opendaylight.mdsal.model + features-mdsal-model + ${mdsal.model.version} + features + xml + runtime + + + org.opendaylight.netconf + features-restconf + ${restconf.version} + features + xml + + + org.opendaylight.netconf + features-netconf-connector + ${netconf.parent.version} + features + xml + runtime + + + org.opendaylight.ovsdb + southbound-features + ${ovsdb.southbound.version} + features + xml + runtime + + + org.opendaylight.l2switch + features-l2switch + ${l2switch.version} + features + xml + - - - org.opendaylight.netconf - sal-rest-docgen - ${restconf.version} - + + + org.opendaylight.netconf + sal-rest-docgen + ${restconf.version} + - + - - ${project.groupId} - sfc-provider - ${project.version} - - - ${project.groupId} - sfc-bootstrap - ${project.version} - - - ${project.groupId} - sfc-model - ${project.version} - - - ${project.groupId} - sfc-test-consumer - ${project.version} - - - ${project.groupId} - sfc-ui-bundle - ${project.version} - - - ${project.groupId} - sfc-jsonconfig - ${project.version} - xml - config - - - ${project.groupId} - sfc-jsonconfig - ${project.version} - xml - config-sff - - - ${project.groupId} - sfc-jsonconfig - ${project.version} - xml - config-sfc - - - ${project.groupId} - sfc-jsonconfig - ${project.version} - xml - config-sn - - - ${project.groupId} - sfc-jsonconfig - ${project.version} - xml - config-sf - - - ${project.groupId} - sfc-jsonconfig - ${project.version} - xml - config-ipfix-class-id - - - ${project.groupId} - sfc-config - ${project.version} - xml - config - - - ${project.groupId} - sfc-test-consumer - ${project.version} - xml - config - - - ch.qos.logback - logback-classic - ${logback.version} - jar - compile - - - ch.qos.logback - logback-core - ${logback.version} - jar - compile - - - com.sun.jersey - jersey-client - ${jersey.version} - - - com.sun.jersey - jersey-core - ${jersey.version} - - - org.json - json - ${org.json.version} - - - org.codehaus.jettison - jettison - ${jettison.version} - - - com.google.code.gson - gson - ${gson.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-json-org - ${jackson.version} - + + ${project.groupId} + sfc-provider + ${project.version} + + + ${project.groupId} + sfc-bootstrap + ${project.version} + + + ${project.groupId} + sfc-model + ${project.version} + + + ${project.groupId} + sfc-test-consumer + ${project.version} + + + ${project.groupId} + sfc-ui-bundle + ${project.version} + + + ${project.groupId} + sfc-jsonconfig + ${project.version} + xml + config + + + ${project.groupId} + sfc-jsonconfig + ${project.version} + xml + config-sff + + + ${project.groupId} + sfc-jsonconfig + ${project.version} + xml + config-sfc + + + ${project.groupId} + sfc-jsonconfig + ${project.version} + xml + config-sn + + + ${project.groupId} + sfc-jsonconfig + ${project.version} + xml + config-sf + + + ${project.groupId} + sfc-jsonconfig + ${project.version} + xml + config-ipfix-class-id + + + ${project.groupId} + sfc-config + ${project.version} + xml + config + + + ${project.groupId} + sfc-test-consumer + ${project.version} + xml + config + + + ${project.groupId} + sfc-vnfm + ${project.version} + xml + config + + + ch.qos.logback + logback-classic + ${logback.version} + jar + compile + + + ch.qos.logback + logback-core + ${logback.version} + jar + compile + + + com.sun.jersey + jersey-client + ${jersey.version} + + + com.sun.jersey + jersey-core + ${jersey.version} + + + org.json + json + ${org.json.version} + + + org.codehaus.jettison + jettison + ${jettison.version} + + + com.google.code.gson + gson + ${gson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-json-org + ${jackson.version} + - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-base - ${jackson.version} - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - ${jackson.version} - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson.version} - - - org.glassfish - javax.json - 1.0.4 - - - - org.opendaylight.odlparent - features-test - ${feature.test.version} - test - - - - org.opendaylight.controller - opendaylight-karaf-empty - ${karaf.empty.version} - zip - - - - org.slf4j - slf4j-simple - ${slf4j.version} - - - - org.opendaylight.ovsdb - southbound-api - ${ovsdb.southbound.version} - - - org.opendaylight.ovsdb - southbound-impl - ${ovsdb.southbound.version} - - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-resources-plugin - - - filter - generate-resources - - resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.helper.version} - - - attach-artifacts - package - - attach-artifact - - - - - ${project.build.directory}/classes/${features.file} - xml - features - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - org.opendaylight.controller - opendaylight-karaf-empty - ${karaf.empty.version} - - - org.opendaylight.odlparent:features-test - - - - - - - scm:git:ssh://git.opendaylight.org:29418/sfc.git - scm:git:ssh://git.opendaylight.org:29418/sfc.git - HEAD - https://git.opendaylight.org/gerrit/gitweb?p=sfc.git;a=summary - + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base + ${jackson.version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson.version} + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + ${jackson.version} + + + org.glassfish + javax.json + 1.0.4 + + + + org.opendaylight.odlparent + features-test + ${feature.test.version} + test + + + + org.opendaylight.controller + opendaylight-karaf-empty + ${karaf.empty.version} + zip + + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + + org.opendaylight.ovsdb + southbound-api + ${ovsdb.southbound.version} + + + org.opendaylight.ovsdb + southbound-impl + ${ovsdb.southbound.version} + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + + filter + generate-resources + + resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.helper.version} + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.directory}/classes/${features.file} + xml + features + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.opendaylight.controller + opendaylight-karaf-empty + ${karaf.empty.version} + + + org.opendaylight.odlparent:features-test + + + + + + + scm:git:ssh://git.opendaylight.org:29418/sfc.git + scm:git:ssh://git.opendaylight.org:29418/sfc.git + HEAD + https://git.opendaylight.org/gerrit/gitweb?p=sfc.git;a=summary + diff --git a/pom.xml b/pom.xml index 77cfe4a1c..f9d99a191 100644 --- a/pom.xml +++ b/pom.xml @@ -168,12 +168,14 @@ sfc-netconf sfc-config sfc-jsonconfig + sfc-vnfm features-sfc-sb-rest features-sfclisp features-sfcofl2 features-sfc-scf-openflow features-sfc-ovs features-sfc-netconf + features-sfc-vnfm features sfc-karaf sfc-bootstrap diff --git a/sfc-vnfm/pom.xml b/sfc-vnfm/pom.xml new file mode 100755 index 000000000..111547fbc --- /dev/null +++ b/sfc-vnfm/pom.xml @@ -0,0 +1,170 @@ + + + 4.0.0 + + org.opendaylight.sfc + sfc-parent + 0.2.0-SNAPSHOT + ../ + + + sfc-vnfm + 0.2.0-SNAPSHOT + bundle + + + ${project.build.directory}/generated-sources/config + configuration/initial/sfc-vnfm-initial.xml + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/classes/${configfile} + xml + config + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + process-sources + + check + + + + + true + ../checkstyle.xml + true + true + ${project.basedir} + **\/*.yang,**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat + **\/target\/,**\/bin\/,**\/third-party,**\/yang-gen-sal\/ + + + + org.apache.felix + maven-bundle-plugin + + + org.opendaylight.yangtools + yang-maven-plugin + + + config + + generate-sources + + + + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + + + src/main/yang-gen-config + + + urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang + + + + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + + ${project.build.directory}/generated-sources/sal + + + + org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl + + + src/main/yang-gen-sal + + + true + + + + + + org.opendaylight.controller + yang-jmx-generator-plugin + + ${config.version} + + + org.opendaylight.mdsal + maven-sal-api-gen-plugin + ${yangtools.version} + jar + + + org.osgi + org.osgi.core + ${osgi.core.version} + compile + + + + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${yangtools.version} + + + + + + + + ${project.groupId} + sfc-provider + ${project.version} + + + org.opendaylight.controller + sal-binding-broker-impl + test + + + org.opendaylight.controller + sal-binding-broker-impl + test-jar + test + + + junit + junit + + [4.8.1, 4.11] + + test + + + diff --git a/sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModule.java b/sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModule.java new file mode 100644 index 000000000..82318fa24 --- /dev/null +++ b/sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModule.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + + +package org.opendaylight.controller.config.yang.config.sfc_vnfm.impl; + +import org.opendaylight.sfc.provider.OpendaylightSfc; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.ExecutionException; + +public class SfcVnfmModule extends org.opendaylight.controller.config.yang.config.sfc_vnfm.impl.AbstractSfcVnfmModule { + + private static final Logger LOG = LoggerFactory.getLogger(SfcVnfmModule.class); + + + public SfcVnfmModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public SfcVnfmModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.sfc_vnfm.impl.SfcVnfmModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + final OpendaylightSfc opendaylightSfc = OpendaylightSfc.getOpendaylightSfcObj(); + LOG.info("SFC Vnf module initialized"); + + // close() + final class AutoCloseableSfcVnfm implements AutoCloseable { + + @Override + public void close() { + + try { + opendaylightSfc.close(); + } catch (ExecutionException | InterruptedException e) { + LOG.error("\nFailed to close SfcVnfModule instance {} cleanly", this); + } + LOG.info("SfcVnfModule (instance {}) torn down", this); + } + } + + return new AutoCloseableSfcVnfm(); + } + +} diff --git a/sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModuleFactory.java b/sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModuleFactory.java new file mode 100644 index 000000000..edb61cb74 --- /dev/null +++ b/sfc-vnfm/src/main/java/org/opendaylight/controller/config/yang/config/sfc_vnfm/impl/SfcVnfmModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: sfc-vnfm-impl yang module local name: sfc-vnfm-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Tue Oct 27 23:47:27 PDT 2015 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.config.sfc_vnfm.impl; +public class SfcVnfmModuleFactory extends org.opendaylight.controller.config.yang.config.sfc_vnfm.impl.AbstractSfcVnfmModuleFactory { + +} diff --git a/sfc-vnfm/src/main/java/org/opendaylight/org/opendaylight/sfc/sfc_vnfm/api/ServiceFunctionVnfm.java b/sfc-vnfm/src/main/java/org/opendaylight/org/opendaylight/sfc/sfc_vnfm/api/ServiceFunctionVnfm.java new file mode 100644 index 000000000..78e63d0b8 --- /dev/null +++ b/sfc-vnfm/src/main/java/org/opendaylight/org/opendaylight/sfc/sfc_vnfm/api/ServiceFunctionVnfm.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.org.opendaylight.sfc.sfc_vnfm.api; + +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity; + +/** + * Interface for VNFM operations. Concrete implementations + * such as a Tacker API will need to override these methods + *

+ * + * @author Reinaldo Penno (rapenno@gmail.com) + * @version 0.1 + * @since 2015-10-18 + */ +public interface ServiceFunctionVnfm { + void createServiceFunction(String serviceFunctionName, Class serviceFunctionType); + void deleteServiceFunction(String serviceFunctionName); + void getServiceFunctionStats(String serviceFunctionName); + void suspendServiceFunction(String serviceFunctionName); +} diff --git a/sfc-vnfm/src/main/java/org/opendaylight/sfc/sfc_vnfm/provider/SfcVnfmDataProvider.java b/sfc-vnfm/src/main/java/org/opendaylight/sfc/sfc_vnfm/provider/SfcVnfmDataProvider.java new file mode 100755 index 000000000..a07353b02 --- /dev/null +++ b/sfc-vnfm/src/main/java/org/opendaylight/sfc/sfc_vnfm/provider/SfcVnfmDataProvider.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.sfc.sfc_vnfm.provider; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext; + +import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer; + +public class SfcVnfmDataProvider implements BindingAwareConsumer { + + static SfcVnfmDataProvider sfcVnfmDataProvider; + + /* + * Factory method + */ + public static SfcVnfmDataProvider GetVnfmDataProvider() { + if (sfcVnfmDataProvider != null) + return sfcVnfmDataProvider; + else { + sfcVnfmDataProvider = new SfcVnfmDataProvider(); + return sfcVnfmDataProvider; + } + } + + @Override + public void onSessionInitialized(ConsumerContext session) { + return; + } + +} diff --git a/sfc-vnfm/src/main/resources/configuration/initial/sfc-vnfm-initial.xml b/sfc-vnfm/src/main/resources/configuration/initial/sfc-vnfm-initial.xml new file mode 100644 index 000000000..955f94d1e --- /dev/null +++ b/sfc-vnfm/src/main/resources/configuration/initial/sfc-vnfm-initial.xml @@ -0,0 +1,33 @@ + + + + + + + + sfc-vnfm:sfc-vnfm-impl + + sfc-vnfm-impl + + + binding:binding-async-data-broker + binding-data-broker + + + + binding:binding-broker-osgi-registry + binding-osgi-broker + + + + + + + + + urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28 + urn:opendaylight:params:xml:ns:yang:controller:config:sfc-provider:impl?module=sfc-provider-impl&revision=2014-06-30 + urn:opendaylight:params:xml:ns:yang:controller:config:sfc-vnfm:impl?module=sfc-vnfm-impl&revision=2014-10-20 + + + diff --git a/sfc-vnfm/src/main/yang/sfc-vnfm-impl.yang b/sfc-vnfm/src/main/yang/sfc-vnfm-impl.yang new file mode 100755 index 000000000..8281301fc --- /dev/null +++ b/sfc-vnfm/src/main/yang/sfc-vnfm-impl.yang @@ -0,0 +1,53 @@ +module sfc-vnfm-impl { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sfc-vnfm:impl"; + prefix "sfc-vnfm-impl"; + + import config { prefix config; revision-date 2013-04-05; } + import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; } + + + description + "This module contains the base YANG definitions for + sfc-vnfm implementation."; + + revision "2014-10-20" { + description + "Initial revision."; + } + + // This is the definition of the service implementation as a module identity + identity sfc-vnfm-impl { + base config:module-type; + + // Specifies the prefix for generated java classes. + config:java-name-prefix SfcVnfm; + } + + + // Augments the 'configuration' choice node under modules/module. + augment "/config:modules/config:module/config:configuration" { + case sfc-vnfm-impl { + when "/config:modules/config:module/config:type = 'sfc-vnfm-impl'"; + + //wires in the data-broker service + container data-broker { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity mdsal:binding-async-data-broker; + } + } + } + container binding-registry { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-broker-osgi-registry; + } + } + } + } + } +} diff --git a/sfc-vnfm/src/test/java/org/opendaylight/sfc/sfc_vnfm/provider/api/SfcVnfmAPITest.java b/sfc-vnfm/src/test/java/org/opendaylight/sfc/sfc_vnfm/provider/api/SfcVnfmAPITest.java new file mode 100755 index 000000000..6b8ef1d46 --- /dev/null +++ b/sfc-vnfm/src/test/java/org/opendaylight/sfc/sfc_vnfm/provider/api/SfcVnfmAPITest.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.sfc.sfc_vnfm.provider.api; + +import org.junit.Before; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest; +import org.opendaylight.sfc.provider.OpendaylightSfc; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfName; + +public class SfcVnfmAPITest extends AbstractDataBrokerTest { + + private final OpendaylightSfc opendaylightSfc = new OpendaylightSfc(); + private static final String IP_MGMT_ADDRESS = "192.168.1.2"; + private static final int DP_PORT = 6633; + private static final SfName SF_NAME = new SfName("dummySF"); + private static final SfName SF_STATE_NAME = new SfName("dummySFS"); + + @Before + public void before() { + DataBroker dataBroker = getDataBroker(); + opendaylightSfc.setDataProvider(dataBroker); + } +} -- 2.36.6