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
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);
@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;
- }
}
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);
- }
- }
}
--- /dev/null
+{
+ "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
+}