From: Flavio Fernandes Date: Thu, 15 Oct 2015 17:17:06 +0000 (+0000) Subject: Merge "Adding copyright header to ovsdb/southbound UT" X-Git-Tag: release/beryllium-sr2~354 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=3bc56b6ef619e815b259f179b27a8668bf1cd1a3;hp=6e6cd39a16d58daf6df3cd9cb10c0624b316a96a;p=netvirt.git Merge "Adding copyright header to ovsdb/southbound UT" --- diff --git a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcProvider.java b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcProvider.java index 144514f9df..3dba7b4b57 100644 --- a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcProvider.java +++ b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcProvider.java @@ -19,26 +19,17 @@ import org.slf4j.LoggerFactory; public class NetvirtSfcProvider implements BindingAwareProvider, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(NetvirtSfcProvider.class); - private DataBroker dataBroker = null; - private BundleContext bundleContext = null; private NetvirtSfcAclListener aclListener; - private NetvirtSfcClassifierListener classfierListener; - private INetvirtSfcOF13Provider provider; - - public NetvirtSfcProvider(BundleContext bundleContext) { - LOG.info("NetvirtProvider: bundleContext: {}", bundleContext); - this.bundleContext = bundleContext; - } @Override public void onSessionInitiated(ProviderContext session) { LOG.info("NetvirtSfcProvider Session Initiated"); - dataBroker = session.getSALService(DataBroker.class); + DataBroker dataBroker = session.getSALService(DataBroker.class); - provider = new NetvirtSfcOF13Provider(this.dataBroker); - aclListener = new NetvirtSfcAclListener(provider, this.dataBroker); - classfierListener = new NetvirtSfcClassifierListener(provider, this.dataBroker); + INetvirtSfcOF13Provider provider = new NetvirtSfcOF13Provider(dataBroker); + aclListener = new NetvirtSfcAclListener(provider, dataBroker); + classfierListener = new NetvirtSfcClassifierListener(provider, dataBroker); } @Override diff --git a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModule.java b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModule.java index 9135aeb68c..137b77f8ae 100644 --- a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModule.java +++ b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModule.java @@ -8,7 +8,6 @@ import org.osgi.framework.BundleContext; public class NetvirtSfcModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.rev141210.AbstractNetvirtSfcModule { private static final Logger LOG = LoggerFactory.getLogger(NetvirtSfcModule.class); - private BundleContext bundleContext = null; public NetvirtSfcModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); @@ -26,13 +25,8 @@ public class NetvirtSfcModule extends org.opendaylight.yang.gen.v1.urn.opendayli @Override public java.lang.AutoCloseable createInstance() { LOG.info("Netvirt SFC module initialization."); - //final NetvirtSfcProvider sfcProvider = new NetvirtSfcProvider(getDataBrokerDependency()); - final NetvirtSfcProvider sfcProvider = new NetvirtSfcProvider(bundleContext); + NetvirtSfcProvider sfcProvider = new NetvirtSfcProvider(); getBrokerDependency().registerProvider(sfcProvider); return sfcProvider; } - - public void setBundleContext(BundleContext bundleContext) { - this.bundleContext = bundleContext; - } } diff --git a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModuleFactory.java b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModuleFactory.java index 6bbc368238..8468b165e5 100644 --- a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModuleFactory.java +++ b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/netvirt/sfc/rev141210/NetvirtSfcModuleFactory.java @@ -17,36 +17,4 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NetvirtSfcModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.rev141210.AbstractNetvirtSfcModuleFactory { - private static final Logger LOG = LoggerFactory.getLogger(NetvirtSfcModuleFactory.class); - - @Override - public Module createModule(String instanceName, - DependencyResolver dependencyResolver, - DynamicMBeanWithInstance old, BundleContext bundleContext) - throws Exception { - Module module = super.createModule(instanceName, dependencyResolver, old, bundleContext); - LOG.info("Created NetvirtSfcModule1= {}!!", (module instanceof NetvirtSfcModule)); - setModuleBundleContext(bundleContext, module); - return module; - } - - @Override - public Module createModule(String instanceName, - DependencyResolver dependencyResolver, BundleContext bundleContext) { - Module module = super.createModule(instanceName, dependencyResolver, bundleContext); - LOG.info("Created NetvirtSfcModule2= {}!!", (module instanceof NetvirtSfcModule)); - setModuleBundleContext(bundleContext, module); - return module; - } - - private void setModuleBundleContext(BundleContext bundleContext, - Module module) { - if (module instanceof NetvirtSfcModule) { - LOG.info("Setting Bundle Context for NetvirtSfcModule!!"); - ((NetvirtSfcModule)module).setBundleContext(bundleContext); - } else { - LOG.warn("Module is of type {} expected type {}", - module.getClass(), NetvirtSfcModule.class); - } - } } diff --git a/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java b/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java index 9eef40d7af..5fbe1ca5c1 100644 --- a/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java +++ b/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java @@ -181,6 +181,7 @@ public class NetvirtSfcIT extends AbstractMdsalTestBase { } try { + Thread.sleep(1000); super.setup(); } catch (Exception e) { e.printStackTrace(); diff --git a/resources/commons/NetvirtSfc.json.postman_collection b/resources/commons/NetvirtSfc.json.postman_collection new file mode 100644 index 0000000000..3c64af8361 --- /dev/null +++ b/resources/commons/NetvirtSfc.json.postman_collection @@ -0,0 +1,105 @@ +{ + "id": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "name": "NetvirtSfc", + "requests": [ + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "{\n \"access-lists\": {\n \"access-list\": [\n {\n \"acl-name\": \"http-acl\",\n \"access-list-entries\": {\n \"access-list-entry\": [\n {\n \"rule-name\": \"http-rule\",\n \"matches\": {\n \"destination-port-range\": {\n \"lower-port\": \"80\",\n \"upper-port\": \"80\"\n }\n },\n \"actions\": {\n \"permit\": {}\n }\n }\n ]\n }\n }\n ]\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "id": "37a68007-fc51-b406-43fe-dcaba62e3879", + "method": "GET", + "name": "Acl", + "responses": [], + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/ietf-acl:access-lists", + "version": 2 + }, + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "{\n \"classifiers\": {\n \"classifier\": [\n {\n \"name\": \"http-classifier\",\n \"acl\": \"http-acl\",\n \"sffs\": {\n \"sff\": [\n {\n \"name\": \"sff1\"\n }\n ]\n }\n }\n ]\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "id": "718ed9fd-f7f3-3862-4a53-b12d83c880ae", + "method": "PUT", + "name": "Classifier", + "time": 1444924721709, + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/netvirt-sfc-classifier:classifiers", + "version": 2 + }, + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "{\n\t\"sfc\": {\n \"name\": \"sfc1\"\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "id": "9d418a4b-197d-47c2-e85f-e68f6b5f5c40", + "method": "GET", + "name": "Sfc", + "responses": [], + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/netvirt-sfc:sfc/", + "version": 2 + }, + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "{\n \"access-lists\": {\n \"access-list\": [\n {\n \"acl-name\": \"http-acl\",\n \"access-list-entries\": {\n \"access-list-entry\": [\n {\n \"rule-name\": \"http-rule\",\n \"matches\": {\n \"destination-port-range\": {\n \"lower-port\": \"80\",\n \"upper-port\": \"80\"\n }\n },\n \"actions\": {\n \"permit\": {}\n }\n }\n ]\n }\n }\n ]\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Content-Type: application/json\n", + "id": "9e688730-6234-8f89-3de2-8a9974c4ea59", + "method": "PUT", + "name": "Acl", + "time": 1444923678505, + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/ietf-acl:access-lists", + "version": 2 + }, + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "{\n \"classifiers\": {\n \"classifier\": [\n {\n \"name\": \"http-classifier\",\n \"acl\": \"http-acl\",\n \"sffs\": {\n \"sff\": [\n {\n \"name\": \"sff1\"\n }\n ]\n }\n }\n ]\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "id": "b2d13061-80e0-ad8f-d0e6-d6939ea2b0a4", + "method": "GET", + "name": "Classifier", + "responses": [], + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/netvirt-sfc-classifier:classifiers", + "version": 2 + }, + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "http://localhost:8181/restconf/config/ietf-acl:access-lists\n{\n \"access-lists\": {\n \"access-list\": [\n {\n \"acl-name\": \"http-acl\",\n \"access-list-entries\": {\n \"access-list-entry\": [\n {\n \"rule-name\": \"http-rule\",\n \"matches\": {\n \"destination-port-range\": {\n \"lower-port\": \"80\",\n \"upper-port\": \"80\"\n }\n },\n \"actions\": {\n \"netvirt-sfc-acl:redirect-sfc\": \"acl\"\n }\n }\n ]\n }\n }\n ]\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Content-Type: application/json\n", + "id": "c3d5a025-23c6-af23-dce1-9edca74cd65c", + "method": "PUT", + "name": "Acl - redirect-sfc", + "responses": [], + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/ietf-acl:access-lists", + "version": 2 + }, + { + "collectionId": "bc172f70-35df-2cdf-50a4-8ad09b8f17a2", + "data": "{\n\t\"sfc\": {\n \"name\": \"sfc1\"\n }\n}", + "dataMode": "raw", + "description": "", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "id": "ea1c70a0-6528-862c-cabc-a9b187d483c7", + "method": "PUT", + "name": "Sfc", + "responses": [], + "timestamp": 0, + "url": "http://localhost:8181/restconf/config/netvirt-sfc:sfc/", + "version": 2 + } + ], + "timestamp": 1444922427094 +} diff --git a/resources/commons/README b/resources/commons/README index 98de4d5bab..25cf72cccf 100644 --- a/resources/commons/README +++ b/resources/commons/README @@ -27,4 +27,4 @@ Contents - 3-Node-Cluster-Setup-Environment-Variables.postman_environment : Postman environment file that defines variables for Restconf request for southbound plugin running in 3 node cluster environment - +- NetvirtSfc.json.postman_collection : Collection of REST-APIs to interact with Netvirt-Sfc.