From 26857e151f21d505eeb48cc9f0abe7e2cdec1468 Mon Sep 17 00:00:00 2001 From: sonicke <10112215@zte.com.cn> Date: Sun, 11 Feb 2018 10:28:28 +0800 Subject: rename openo to onap Change-Id: I2cf180595e682becfca5848c704aee406d971337 Issue-ID: VFC-755 Signed-off-by: Zhuoyao Huang <10112215@zte.com.cn> --- .../plugin-standalone/src/main/assembly/run.sh | 2 +- .../src/main/java/org/onap/sfc/SfcDriver.java | 94 +++++++++ .../main/java/org/onap/sfc/SfcDriverConfig.java | 61 ++++++ .../java/org/onap/sfc/entity/ChainParameter.java | 43 +++++ .../main/java/org/onap/sfc/entity/DelReqInfo.java | 46 +++++ .../java/org/onap/sfc/entity/FlowClassfierReq.java | 110 +++++++++++ .../org/onap/sfc/entity/FlowClassfierReq4N.java | 109 +++++++++++ .../org/onap/sfc/entity/FlowClassifierReq4S.java | 35 ++++ .../org/onap/sfc/entity/MsbRegisterEntity.java | 78 ++++++++ .../main/java/org/onap/sfc/entity/NodeEntity.java | 49 +++++ .../java/org/onap/sfc/entity/PortChainReq.java | 67 +++++++ .../java/org/onap/sfc/entity/PortChainReq4N.java | 84 ++++++++ .../java/org/onap/sfc/entity/PortChainReq4S.java | 34 ++++ .../java/org/onap/sfc/entity/PortPairGroupReq.java | 44 +++++ .../org/onap/sfc/entity/PortPairGroupReq4N.java | 68 +++++++ .../org/onap/sfc/entity/PortPairGroupReq4S.java | 33 ++++ .../src/main/java/org/onap/sfc/entity/Result.java | 32 +++ .../org/onap/sfc/entity/SdnControllerInfo.java | 47 +++++ .../org/onap/sfc/entity/portpair/PortInfo.java | 61 ++++++ .../org/onap/sfc/entity/portpair/PortPairReq.java | 63 ++++++ .../onap/sfc/entity/portpair/PortPairReq4N.java | 112 +++++++++++ .../onap/sfc/entity/portpair/PortPairReq4S.java | 34 ++++ .../entity/portpair/ServiceFunctionParameter.java | 41 ++++ .../org/onap/sfc/health/ConsoleHealthCheck.java | 35 ++++ .../org/onap/sfc/resources/DriverResource.java | 214 +++++++++++++++++++++ .../org/onap/sfc/resources/MsbServiceRegister.java | 71 +++++++ .../main/java/org/onap/sfc/service/ConfigInfo.java | 30 +++ .../onap/sfc/service/ISdnControllerService.java | 87 +++++++++ .../main/java/org/onap/sfc/service/MsbService.java | 35 ++++ .../org/onap/sfc/service/SdnServiceConsumer.java | 38 ++++ .../src/main/java/org/onap/sfc/utils/SfcConst.java | 24 +++ .../java/org/onap/sfc/utils/SfcDriverUtil.java | 105 ++++++++++ .../java/org/onap/sfc/wrapper/N2sReqWrapper.java | 106 ++++++++++ .../src/main/java/org/openo/sfc/SfcDriver.java | 94 --------- .../main/java/org/openo/sfc/SfcDriverConfig.java | 61 ------ .../java/org/openo/sfc/entity/ChainParameter.java | 43 ----- .../main/java/org/openo/sfc/entity/DelReqInfo.java | 46 ----- .../org/openo/sfc/entity/FlowClassfierReq.java | 110 ----------- .../org/openo/sfc/entity/FlowClassfierReq4N.java | 109 ----------- .../org/openo/sfc/entity/FlowClassifierReq4S.java | 35 ---- .../org/openo/sfc/entity/MsbRegisterEntity.java | 78 -------- .../main/java/org/openo/sfc/entity/NodeEntity.java | 49 ----- .../java/org/openo/sfc/entity/PortChainReq.java | 67 ------- .../java/org/openo/sfc/entity/PortChainReq4N.java | 84 -------- .../java/org/openo/sfc/entity/PortChainReq4S.java | 34 ---- .../org/openo/sfc/entity/PortPairGroupReq.java | 44 ----- .../org/openo/sfc/entity/PortPairGroupReq4N.java | 68 ------- .../org/openo/sfc/entity/PortPairGroupReq4S.java | 33 ---- .../src/main/java/org/openo/sfc/entity/Result.java | 32 --- .../org/openo/sfc/entity/SdnControllerInfo.java | 47 ----- .../org/openo/sfc/entity/portpair/PortInfo.java | 61 ------ .../org/openo/sfc/entity/portpair/PortPairReq.java | 63 ------ .../openo/sfc/entity/portpair/PortPairReq4N.java | 112 ----------- .../openo/sfc/entity/portpair/PortPairReq4S.java | 34 ---- .../entity/portpair/ServiceFunctionParameter.java | 41 ---- .../org/openo/sfc/health/ConsoleHealthCheck.java | 35 ---- .../org/openo/sfc/resources/DriverResource.java | 214 --------------------- .../openo/sfc/resources/MsbServiceRegister.java | 72 ------- .../java/org/openo/sfc/service/ConfigInfo.java | 30 --- .../openo/sfc/service/ISdnControllerService.java | 87 --------- .../java/org/openo/sfc/service/MsbService.java | 35 ---- .../org/openo/sfc/service/SdnServiceConsumer.java | 38 ---- .../main/java/org/openo/sfc/utils/SfcConst.java | 24 --- .../java/org/openo/sfc/utils/SfcDriverUtil.java | 105 ---------- .../java/org/openo/sfc/wrapper/N2sReqWrapper.java | 106 ---------- .../test/java/org/onap/sfc/TestAuthorization.java | 2 +- .../test/java/org/onap/sfc/TestFlowClassifier.java | 6 +- .../test/java/org/onap/sfc/TestMsbRegister.java | 4 +- .../src/test/java/org/onap/sfc/TestPortChain.java | 4 +- .../src/test/java/org/onap/sfc/TestPortPair.java | 8 +- .../test/java/org/onap/sfc/TestPortPairGroup.java | 6 +- .../src/test/java/org/onap/sfc/TestSfParams.java | 4 +- 72 files changed, 2108 insertions(+), 2109 deletions(-) create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriver.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriverConfig.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/DelReqInfo.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4N.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4S.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4N.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4S.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/health/ConsoleHealthCheck.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/DriverResource.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ConfigInfo.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ISdnControllerService.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/MsbService.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/SdnServiceConsumer.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcConst.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcDriverUtil.java create mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriver.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriverConfig.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/ChainParameter.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/DelReqInfo.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq4N.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassifierReq4S.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/MsbRegisterEntity.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/NodeEntity.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4N.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4S.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4N.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4S.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/Result.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/SdnControllerInfo.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortInfo.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4N.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4S.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/ServiceFunctionParameter.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/health/ConsoleHealthCheck.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/DriverResource.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/MsbServiceRegister.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ConfigInfo.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ISdnControllerService.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/MsbService.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/SdnServiceConsumer.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcConst.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcDriverUtil.java delete mode 100644 zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/wrapper/N2sReqWrapper.java diff --git a/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh b/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh index ae8318a..5a9ba00 100644 --- a/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh +++ b/zte/sfc-driver/plugin-standalone/src/main/assembly/run.sh @@ -43,6 +43,6 @@ echo @JAVA_OPTS@ $JAVA_OPTS class_path="$RUNHOME/:$RUNHOME/sfc-service.jar" echo @class_path@ $class_path -"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.sfc.SfcDriver server "$RUNHOME/conf/console.yml" +"$JAVA" $JAVA_OPTS -classpath "$class_path" SfcDriver server "$RUNHOME/conf/console.yml" diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriver.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriver.java new file mode 100644 index 0000000..57e50a5 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriver.java @@ -0,0 +1,94 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.dropwizard.Application; +import io.dropwizard.assets.AssetsBundle; +import io.dropwizard.server.SimpleServerFactory; +import io.dropwizard.setup.Bootstrap; +import io.dropwizard.setup.Environment; +import io.swagger.jaxrs.config.BeanConfig; +import io.swagger.jaxrs.listing.ApiListingResource; +import org.onap.sfc.utils.SfcConst; +import org.onap.sfc.health.ConsoleHealthCheck; +import org.onap.sfc.resources.DriverResource; +import org.onap.sfc.service.ConfigInfo; +import org.onap.sfc.resources.MsbServiceRegister; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SfcDriver extends Application { + + private static final Logger LOGGER = LoggerFactory.getLogger(SfcDriver.class); + + public static void main(String[] args) throws Exception { + new SfcDriver().run(args); + } + + @Override + public String getName() { + return SfcConst.SERVICE_NAME; + } + + @Override + public void initialize(Bootstrap bootstrap) { + bootstrap.addBundle(new AssetsBundle("/iui", "/", "index.html", "iui")); + bootstrap.addBundle(new AssetsBundle("/api-doc", "/api-doc", "index.html", "api-doc")); + } + + @Override + public void run(SfcDriverConfig configuration, + Environment environment) { + final DriverResource driverResource = new DriverResource(); + final ConsoleHealthCheck healthCheck = + new ConsoleHealthCheck(configuration.getTemplate()); + environment.healthChecks().register("template", healthCheck); + environment.jersey().register(driverResource); + ConfigInfo.setConfig(configuration); + + registerService(); + initSwaggerConfig(environment, configuration); + } + + + private void initSwaggerConfig(Environment environment, SfcDriverConfig configuration) { + environment.jersey().register(new ApiListingResource()); + environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); + + BeanConfig config = new BeanConfig(); + config.setTitle(" Console Service rest API"); + config.setVersion("1.0.0"); + config.setResourcePackage("org.openo.sfc.resources"); + //swagger rest api basepath + SimpleServerFactory simpleServerFactory = (SimpleServerFactory) configuration.getServerFactory(); + String basePath = simpleServerFactory.getApplicationContextPath(); + + basePath = basePath.endsWith("/") ? basePath : (new StringBuilder()).append(basePath).append('/').toString(); + basePath = basePath + "service"; + LOGGER.info("getApplicationContextPath: " + basePath); + config.setBasePath(basePath); + config.setScan(true); + } + + private void registerService() + { + Thread msbRegisterThread = new Thread(new MsbServiceRegister()); + msbRegisterThread.setName("Register Service 2 MSB"); + msbRegisterThread.start(); + } + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriverConfig.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriverConfig.java new file mode 100644 index 0000000..c3293ab --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriverConfig.java @@ -0,0 +1,61 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.dropwizard.Configuration; +import org.hibernate.validator.constraints.NotEmpty; + + +public class SfcDriverConfig extends Configuration { + @NotEmpty + private String template; + + @NotEmpty + private String defaultName = "Stranger"; + + @NotEmpty + private String msbServiceUrl; + + @JsonProperty + public String getTemplate() { + return template; + } + + @JsonProperty + public void setTemplate(String template) { + this.template = template; + } + + @JsonProperty + public String getDefaultName() { + return defaultName; + } + @JsonProperty + public void setDefaultName(String name) { + this.defaultName = name; + } + + public String getMsbServiceUrl() { + return msbServiceUrl; + } + + public void setMsbServiceUrl(String msbServiceUrl) { + this.msbServiceUrl = msbServiceUrl; + } + +} \ No newline at end of file diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java new file mode 100644 index 0000000..4b17a41 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java @@ -0,0 +1,43 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +public class ChainParameter { + @SerializedName("chain-parameter") + private String chainParameter; + @SerializedName("chain-parameter-value") + private String chainParamValue; + + public String getChainParameter() { + return chainParameter; + } + + public void setChainParameter(String chainParameter) { + this.chainParameter = chainParameter; + } + + public String getChainParamValue() { + return chainParamValue; + } + + public void setChainParamValue(String chainParamValue) { + this.chainParamValue = chainParamValue; + } + + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/DelReqInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/DelReqInfo.java new file mode 100644 index 0000000..1b7240d --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/DelReqInfo.java @@ -0,0 +1,46 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +public class DelReqInfo { + private String sdnControllerId; + private String url; + private String id; + + public String getSdnControllerId() { + return sdnControllerId; + } + + public void setSdnControllerId(String sdnControllerId) { + this.sdnControllerId = sdnControllerId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq.java new file mode 100644 index 0000000..daa3923 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq.java @@ -0,0 +1,110 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +public class FlowClassfierReq { + private String protocol; + @SerializedName("source-port-range-min") + private int sourcePortRangeMin; + @SerializedName("source-port-range-max") + private int sourcePortRangeMax; + @SerializedName("destination-port-range-min") + private int destinationPortRangeMin; + @SerializedName("destination-port-range-max") + private int destinationPortRangeMax; + @SerializedName("source-ip-range") + private String sourceIpRange; + @SerializedName("destination-ip-range") + private String destinationIpRange; + @SerializedName("ip-dscp") + private long ipDscp; + private String uuid; + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public long getIpDscp() { + return ipDscp; + } + + public void setIpDscp(long ipDscp) { + this.ipDscp = ipDscp; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public int getSourcePortRangeMin() { + return sourcePortRangeMin; + } + + public void setSourcePortRangeMin(int sourcePortRangeMin) { + this.sourcePortRangeMin = sourcePortRangeMin; + } + + public int getSourcePortRangeMax() { + return sourcePortRangeMax; + } + + public void setSourcePortRangeMax(int sourcePortRangeMax) { + this.sourcePortRangeMax = sourcePortRangeMax; + } + + public int getDestinationPortRangeMin() { + return destinationPortRangeMin; + } + + public void setDestinationPortRangeMin(int destinationPortRangeMin) { + this.destinationPortRangeMin = destinationPortRangeMin; + } + + public int getDestinationPortRangeMax() { + return destinationPortRangeMax; + } + + public void setDestinationPortRangeMax(int destinationPortRangeMax) { + this.destinationPortRangeMax = destinationPortRangeMax; + } + + + public String getSrcIpRange() { + return sourceIpRange; + } + + public void setSrcIpRange(String srcIpRange) { + this.sourceIpRange = srcIpRange; + } + + public String getDestinationIpRange() { + return destinationIpRange; + } + + public void setDestinationIpRange(String destinationIpRange) { + this.destinationIpRange = destinationIpRange; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java new file mode 100644 index 0000000..7d1f180 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java @@ -0,0 +1,109 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +public class FlowClassfierReq4N { + private String url; + private String sdnControllerId; + private String name; + private String description; + private int dscp; + private String ip_proto; + private String source_port_range; + private String dest_port_range; + private String source_ip_range; + private String dest_ip_range; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getSdnControllerId() { + return sdnControllerId; + } + + public void setSdnControllerId(String sdnControllerId) { + this.sdnControllerId = sdnControllerId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getDscp() { + return dscp; + } + + public void setDscp(int dscp) { + this.dscp = dscp; + } + + public String getIp_proto() { + return ip_proto; + } + + public void setIp_proto(String ip_proto) { + this.ip_proto = ip_proto; + } + + public String getSource_port_range() { + return source_port_range; + } + + public void setSource_port_range(String source_port_range) { + this.source_port_range = source_port_range; + } + + public String getDest_port_range() { + return dest_port_range; + } + + public void setDest_port_range(String dest_port_range) { + this.dest_port_range = dest_port_range; + } + + public String getSource_ip_range() { + return source_ip_range; + } + + public void setSource_ip_range(String source_ip_range) { + this.source_ip_range = source_ip_range; + } + + public String getDest_ip_range() { + return dest_ip_range; + } + + public void setDest_ip_range(String dest_ip_range) { + this.dest_ip_range = dest_ip_range; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java new file mode 100644 index 0000000..4685009 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java @@ -0,0 +1,35 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; + +public class FlowClassifierReq4S { + public ArrayList getSfcFlowClassifier() { + return sfcFlowClassifier; + } + + public void setSfcFlowClassifier(ArrayList sfcFlowClassifier) { + this.sfcFlowClassifier = sfcFlowClassifier; + } + + @SerializedName("sfc-flow-classifier") + ArrayList sfcFlowClassifier; + + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java new file mode 100644 index 0000000..9dcd00e --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java @@ -0,0 +1,78 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.util.ArrayList; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class MsbRegisterEntity { + private String serviceName; + private String version; + private String url; + private String protocol; + private String visualRange; + private ArrayList nodes; + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getVisualRange() { + return visualRange; + } + + public void setVisualRange(String visualRange) { + this.visualRange = visualRange; + } + + public ArrayList getNodes() { + return nodes; + } + + public void setNodes(ArrayList nodes) { + this.nodes = nodes; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java new file mode 100644 index 0000000..493266e --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java @@ -0,0 +1,49 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class NodeEntity { + private String ip; + private String port; + private String ttl; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getTtl() { + return ttl; + } + + public void setTtl(String ttl) { + this.ttl = ttl; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java new file mode 100644 index 0000000..1727008 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java @@ -0,0 +1,67 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.Map; + +public class PortChainReq { + @SerializedName("port-pair-groups") + private ArrayList portPairGroups; + @SerializedName("flow-classifiers") + private ArrayList flowClassifiers; + private String uuid; + @SerializedName("chain-parameters") + private ArrayList chainParams; + + + public ArrayList getChainParams() { + return chainParams; + } + + public void setChainParams(ArrayList chainParams) { + this.chainParams = chainParams; + } + + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + private Map chainParameters; + + public ArrayList getPortPairGroups() { + return portPairGroups; + } + + public void setPortPairGroups(ArrayList portPairGroups) { + this.portPairGroups = portPairGroups; + } + + public ArrayList getFlowClassifiers() { + return flowClassifiers; + } + + public void setFlowClassifiers(ArrayList flowClassifiers) { + this.flowClassifiers = flowClassifiers; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java new file mode 100644 index 0000000..447de12 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java @@ -0,0 +1,84 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import java.util.ArrayList; + +public class PortChainReq4N { + private String sdnControllerId; + private String url; + private String name; + private String description; + private ArrayList flowClassifiers; + private ArrayList portPairGroups; + private boolean symmetric; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getSdnControllerId() { + return sdnControllerId; + } + + public void setSdnControllerId(String sdnControllerId) { + this.sdnControllerId = sdnControllerId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ArrayList getFlowClassifiers() { + return flowClassifiers; + } + + public void setFlowClassifiers(ArrayList flowClassifiers) { + this.flowClassifiers = flowClassifiers; + } + + public ArrayList getPortPairGroups() { + return portPairGroups; + } + + public void setPortPairGroups(ArrayList portPairGroups) { + this.portPairGroups = portPairGroups; + } + + public boolean isSymmetric() { + return symmetric; + } + + public void setSymmetric(boolean symmetric) { + this.symmetric = symmetric; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java new file mode 100644 index 0000000..8b40b27 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java @@ -0,0 +1,34 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; + +public class PortChainReq4S { + + public ArrayList getPortChainReqs() { + return portChainReqs; + } + + public void setPortChainReqs(ArrayList portChainReqs) { + this.portChainReqs = portChainReqs; + } + + @SerializedName("port-chain") + ArrayList portChainReqs; +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq.java new file mode 100644 index 0000000..650f119 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq.java @@ -0,0 +1,44 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + + +public class PortPairGroupReq { + private String uuid; + @SerializedName("port-pairs") + List portPairs; + + public List getPortPairs() { + return portPairs; + } + + public void setPortPairs(List portPairs) { + this.portPairs = portPairs; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4N.java new file mode 100644 index 0000000..e770441 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4N.java @@ -0,0 +1,68 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import java.util.List; + + +public class PortPairGroupReq4N { + String sdnControllerId; + String url; + String name; + String description; + List portPairs; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public String getSdnControllerId() { + return sdnControllerId; + } + + public void setSdnControllerId(String sdnControllerId) { + this.sdnControllerId = sdnControllerId; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getPortPairs() { + return portPairs; + } + + public void setPortPairs(List portPairs) { + this.portPairs = portPairs; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4S.java new file mode 100644 index 0000000..79e3c40 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4S.java @@ -0,0 +1,33 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; + +public class PortPairGroupReq4S { + public ArrayList getPortPairGroupReqs() { + return portPairGroupReqs; + } + + public void setPortPairGroupReqs(ArrayList portPairGroupReqs) { + this.portPairGroupReqs = portPairGroupReqs; + } + + @SerializedName("port-pair-group") + ArrayList portPairGroupReqs; +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java new file mode 100644 index 0000000..14cb73b --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java @@ -0,0 +1,32 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +public class Result { + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + private String id; + + public Result(String uuid) { + this.id = uuid; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java new file mode 100644 index 0000000..5aee863 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java @@ -0,0 +1,47 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity; + +public class SdnControllerInfo { + String url; + String userName; + String password; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java new file mode 100644 index 0000000..0eda970 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java @@ -0,0 +1,61 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity.portpair; + + +import com.google.gson.annotations.SerializedName; + +public class PortInfo { + private String encapsulation; + private String ip; + private String mac; + @SerializedName("port-name") + private String portName; + + public String getEncapsulation() { + return encapsulation; + } + + + public String getPortName() { + return portName; + } + + public void setPortName(String portName) { + this.portName = portName; + } + + public void setEncapsulation(String encapsulation) { + this.encapsulation = encapsulation; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getMac() { + return mac; + } + + public void setMac(String mac) { + this.mac = mac; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq.java new file mode 100644 index 0000000..4b8a66c --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq.java @@ -0,0 +1,63 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity.portpair; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; + + +public class PortPairReq { + private String uuid; + private PortInfo ingress; + private PortInfo egress; + @SerializedName("service-function-parameters") + private ArrayList serviceFunctionParameters; + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public ArrayList getServiceFunctionParameters() { + return serviceFunctionParameters; + } + + public void setServiceFunctionParameters(ArrayList serviceFunctionParameters) { + this.serviceFunctionParameters = serviceFunctionParameters; + } + + public PortInfo getIngress() { + return ingress; + } + + public void setIngress(PortInfo ingress) { + this.ingress = ingress; + } + + public PortInfo getEgress() { + return egress; + } + + public void setEgress(PortInfo egress) { + this.egress = egress; + } + + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4N.java new file mode 100644 index 0000000..7651260 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4N.java @@ -0,0 +1,112 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity.portpair; + +import java.util.Map; + + +public class PortPairReq4N { + private String sdnControllerId; + private String url; + private String name; + private String description; + private String sfType; + private boolean nshAware; + private boolean requestReclassification; + private PortInfo ingress; + private PortInfo egress; + private Map sfParam; + + public String getSdnControllerId() { + return sdnControllerId; + } + + public void setSdnControllerId(String sdnControllerId) { + this.sdnControllerId = sdnControllerId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getSfType() { + return sfType; + } + + public void setSfType(String sfType) { + this.sfType = sfType; + } + + public boolean isNshAware() { + return nshAware; + } + + public void setNshAware(boolean nshAware) { + this.nshAware = nshAware; + } + + public boolean isRequestReclassification() { + return requestReclassification; + } + + public void setRequestReclassification(boolean requestReclassification) { + this.requestReclassification = requestReclassification; + } + + public PortInfo getIngress() { + return ingress; + } + + public void setIngress(PortInfo ingress) { + this.ingress = ingress; + } + + public PortInfo getEgress() { + return egress; + } + + public void setEgress(PortInfo egress) { + this.egress = egress; + } + + public Map getSfParam() { + return sfParam; + } + + public void setSfParam(Map sfParam) { + this.sfParam = sfParam; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4S.java new file mode 100644 index 0000000..2d6933d --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4S.java @@ -0,0 +1,34 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity.portpair; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; + +public class PortPairReq4S { + public ArrayList getPortPair() { + return portPair; + } + + public void setPortPair(ArrayList portPair) { + this.portPair = portPair; + } + + @SerializedName("port-pair") + ArrayList portPair; + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java new file mode 100644 index 0000000..28dd1b8 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java @@ -0,0 +1,41 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.entity.portpair; + +import com.google.gson.annotations.SerializedName; + +public class ServiceFunctionParameter { + @SerializedName("service-function-parameter") + private String serviceFunctionParamter; + @SerializedName("service-function-parameter-value") + private String getServiceFunctionParamterValue; + + public String getServiceFunctionParamter() { + return serviceFunctionParamter; + } + + public void setServiceFunctionParamter(String serviceFunctionParamter) { + this.serviceFunctionParamter = serviceFunctionParamter; + } + + public String getGetServiceFunctionParamterValue() { + return getServiceFunctionParamterValue; + } + + public void setGetServiceFunctionParamterValue(String getServiceFunctionParamterValue) { + this.getServiceFunctionParamterValue = getServiceFunctionParamterValue; + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/health/ConsoleHealthCheck.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/health/ConsoleHealthCheck.java new file mode 100644 index 0000000..737b3d1 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/health/ConsoleHealthCheck.java @@ -0,0 +1,35 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.health; + +import com.codahale.metrics.health.HealthCheck; + +public class ConsoleHealthCheck extends HealthCheck { + private final String template; + + public ConsoleHealthCheck(String template) { + this.template = template; + } + + @Override + protected Result check() throws Exception { + final String saying = String.format(template, "TEST"); + if (!saying.contains("TEST")) { + return Result.unhealthy("template doesn't include a name"); + } + return Result.healthy(); + } +} \ No newline at end of file diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/DriverResource.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/DriverResource.java new file mode 100644 index 0000000..0c75e31 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/DriverResource.java @@ -0,0 +1,214 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.resources; + +import com.codahale.metrics.annotation.Timed; +import org.onap.sfc.entity.FlowClassifierReq4S; +import org.onap.sfc.entity.PortChainReq4S; +import org.onap.sfc.entity.PortPairGroupReq4N; +import org.onap.sfc.entity.PortPairGroupReq4S; +import org.onap.sfc.entity.portpair.PortPairReq4N; +import org.onap.sfc.entity.portpair.PortPairReq4S; +import org.onap.sfc.utils.SfcDriverUtil; +import org.onap.sfc.wrapper.N2sReqWrapper; +import org.onap.sfc.entity.DelReqInfo; +import org.onap.sfc.entity.FlowClassfierReq4N; +import org.onap.sfc.entity.PortChainReq4N; +import org.onap.sfc.entity.Result; +import org.onap.sfc.service.SdnServiceConsumer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.DELETE; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/") +public class DriverResource { + private static final Logger LOGGER = LoggerFactory.getLogger(DriverResource.class); +// +// @POST +// @Path("/checksdncontroller") +// @Produces(MediaType.APPLICATION_JSON) +// @Timed +// public Result checkSdnController(SdnControllerInfo sdnInfo) +// throws Exception { +// if (sdnInfo == null ) { +// throw new NotFoundException("SdnControllerInfo is null"); +// } +// return SdnServiceConsumer.getSdnConProxy(sdnInfo.getUrl()).querySdnController(); +// } + + @POST + @Path("/createportpair") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public Result createPortPair(PortPairReq4N portPairReq4N) + throws Exception { + if (portPairReq4N == null) { + throw new NotFoundException("SdnControllerInfo is null"); + } + LOGGER.info(SfcDriverUtil.toJson(portPairReq4N)); + PortPairReq4S portPairReq = N2sReqWrapper.convertPortPair(portPairReq4N); + String portPairReqJson = SfcDriverUtil.toJson(portPairReq); + LOGGER.info(portPairReqJson); + SdnServiceConsumer.getSdnConProxy(portPairReq4N.getUrl()).createPortPair(SfcDriverUtil.generateAuthorization(), portPairReqJson); +// +// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) +// { +// return new Result(portPairReq.getPortPair().get(0).getUuid()); +// } +// return rsp; + + return new Result(portPairReq.getPortPair().get(0).getUuid()); + } + + @POST + @Path("/createportpairgroup") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public Result createPortPairGroup(PortPairGroupReq4N portPairGroupReq4N) + throws Exception { + if (portPairGroupReq4N == null) { + throw new NotFoundException("SdnControllerInfo is null"); + } + LOGGER.info(SfcDriverUtil.toJson(portPairGroupReq4N)); + PortPairGroupReq4S portPairGroupReq4S = N2sReqWrapper.convertPortPairGroup(portPairGroupReq4N); + String portPairGroupReqJson = SfcDriverUtil.toJson(portPairGroupReq4S); + LOGGER.info(portPairGroupReqJson); + SdnServiceConsumer.getSdnConProxy(portPairGroupReq4N.getUrl()).createPortPairGroup( + SfcDriverUtil.generateAuthorization(), portPairGroupReqJson); +// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) +// { +// return new Result(portPairGroupReq4S.getPortPairGroupReqs().get(0).getUuid()); +// } +// +// return rsp; + + return new Result(portPairGroupReq4S.getPortPairGroupReqs().get(0).getUuid()); + + } + + @POST + @Path("/createflowclassfier") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public Result createFlowClassfier(FlowClassfierReq4N flowClassfierReq4N) + throws Exception { + if (flowClassfierReq4N == null) { + throw new NotFoundException("FlowClassfierReq4N is null"); + } + LOGGER.info(SfcDriverUtil.toJson(flowClassfierReq4N)); + FlowClassifierReq4S flowClassfierReq4S = N2sReqWrapper. + convertFlowClassfier(flowClassfierReq4N); + String uuid = flowClassfierReq4S.getSfcFlowClassifier().get(0).getUuid(); + String flowClassifierJson = SfcDriverUtil.toJson(flowClassfierReq4S); + LOGGER.info(flowClassifierJson); + SdnServiceConsumer.getSdnConProxy(flowClassfierReq4N.getUrl()).createFlowCla(SfcDriverUtil.generateAuthorization(), flowClassifierJson); +// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) +// { +// return new Result(uuid); +// } +// else +// return rsp; + + return new Result(uuid); + } + + @POST + @Path("/createportchain") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public Result creatPortChain(PortChainReq4N portChainReq4N) + throws Exception { + if (portChainReq4N == null) { + throw new NotFoundException("PortChainReq4N is null"); + } + LOGGER.info(SfcDriverUtil.toJson(portChainReq4N)); + PortChainReq4S portChainReq = N2sReqWrapper.converPortChain(portChainReq4N); + String portChainReqJson = SfcDriverUtil.toJson(portChainReq); + LOGGER.info(portChainReqJson); + SdnServiceConsumer.getSdnConProxy(portChainReq4N.getUrl()).createPortChain( + SfcDriverUtil.generateAuthorization(), portChainReqJson); +// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) +// { +// return new Result(portChainReq.getPortChainReqs().get(0).getUuid()); +// } +// return rsp; + + return new Result(portChainReq.getPortChainReqs().get(0).getUuid()); + + } + + @DELETE + @Path("/delportpair") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public void delPortPair(DelReqInfo delReqInfo) + throws Exception { + if (delReqInfo == null) { + throw new NotFoundException("DelReqInfo is null"); + } + LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); + SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deletePortPair(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); + + } + + @DELETE + @Path("/delportpairgroup") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public void delPortPairGroup(DelReqInfo delReqInfo) + throws Exception { + if (delReqInfo == null) { + throw new NotFoundException("DelReqInfo is null"); + } + LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); + SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deletePortPairGroup(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); + + } + + @DELETE + @Path("/delclassifier") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public void delFlowClassfier(DelReqInfo delReqInfo) + throws Exception { + if (delReqInfo == null) { + throw new NotFoundException("DelReqInfo is null"); + } + LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); + SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deleteFlowClassifiers(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); + + } + + @DELETE + @Path("/delchain") + @Produces(MediaType.APPLICATION_JSON) + @Timed + public void delPortChain(DelReqInfo delReqInfo) + throws Exception { + if (delReqInfo == null) { + throw new NotFoundException("DelReqInfo is null"); + } + LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); + SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deletePortChain(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); + + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java new file mode 100644 index 0000000..8be8bd0 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java @@ -0,0 +1,71 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.resources; + +import org.onap.sfc.utils.SfcDriverUtil; +import org.onap.sfc.entity.MsbRegisterEntity; +import org.onap.sfc.service.ConfigInfo; +import org.onap.sfc.service.SdnServiceConsumer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MsbServiceRegister implements Runnable { + private final Logger LOGGER = LoggerFactory.getLogger(MsbServiceRegister.class); + MsbRegisterEntity entity; + public MsbServiceRegister() + { + initInfo(); + } + + private void initInfo() + { + entity = SfcDriverUtil.getMsbRegisterInfo(); + + } + + @Override + public void run() { + boolean flag = false; + int retryTimes=0; + while (!flag && retryTimes<20) + { + try { + LOGGER.info("Register Msb start:"); + LOGGER.info(SfcDriverUtil.toJson(entity)); + SdnServiceConsumer.getMsbRegisterService(ConfigInfo.getConfig().getMsbServiceUrl()). + registerServce("false",entity); + LOGGER.info("Register Msb end:"); + flag = true; + break; + } catch (Exception e) { + LOGGER.info("Register Msb failed"); + e.printStackTrace(); + threadSleep(30000); + } + } + + } + + private void threadSleep(int second) { + LOGGER.info("start sleep ...."); + try { + Thread.sleep(second); + } catch (InterruptedException error) { + LOGGER.error("thread sleep error.errorMsg:" + error.getMessage()); + } + LOGGER.info("sleep end ."); + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ConfigInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ConfigInfo.java new file mode 100644 index 0000000..7d7a786 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ConfigInfo.java @@ -0,0 +1,30 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.service; + +import org.onap.sfc.SfcDriverConfig; + +public class ConfigInfo { + public static SfcDriverConfig getConfig() { + return config; + } + + public static void setConfig(SfcDriverConfig sfcDriverConfig) { + config = sfcDriverConfig; + } + + private static SfcDriverConfig config; +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ISdnControllerService.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ISdnControllerService.java new file mode 100644 index 0000000..91aad18 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ISdnControllerService.java @@ -0,0 +1,87 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.service; + +import org.onap.sfc.entity.Result; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +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; + + +@Path("/restconf/config/neutron:neutron") +public interface ISdnControllerService { + + @Path("/") + @GET + @Produces(MediaType.APPLICATION_JSON) + public Result querySdnController() throws Exception; + + @Path("/port-pairs") + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public Response createPortPair(@HeaderParam("Authorization") String authorization, String portPairReq4S) throws Exception; + + @Path("/port-pair-groups") + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public Response createPortPairGroup(@HeaderParam("Authorization") String authorization, String ppg4S) throws Exception; + + @Path("/sfc-flow-classifiers") + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public Response createFlowCla(@HeaderParam("Authorization") String authorization, String flowClassfierReq) throws Exception; + + + @Path("/port-chains") + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public Response createPortChain(@HeaderParam("Authorization") String authorization, String portChainReq4S) throws Exception; + + @Path("/port-pairs/port-pair/{id}") + @DELETE + @Produces(MediaType.APPLICATION_JSON) + public Response deletePortPair(@HeaderParam("Authorization") String authorization, @PathParam("id") String id) throws Exception; + + + @Path("/port-pair-groups/port-pair-group/{id}") + @DELETE + @Produces(MediaType.APPLICATION_JSON) + public Response deletePortPairGroup(@HeaderParam("Authorization") String authorization, @PathParam("id") String uuid) throws Exception; + + @Path("/sfc-flow-classifiers/sfc-flow-classifier/{id}") + @DELETE + @Produces(MediaType.APPLICATION_JSON) + public Response deleteFlowClassifiers(@HeaderParam("Authorization") String authorization, @PathParam("id") String id) throws Exception; + + @Path("/port-chains/port-chain/{id}") + @DELETE + @Produces(MediaType.APPLICATION_JSON) + public Response deletePortChain(@HeaderParam("Authorization") String authorization, @PathParam("id") String id) throws Exception; + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/MsbService.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/MsbService.java new file mode 100644 index 0000000..fae871b --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/MsbService.java @@ -0,0 +1,35 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.service; + +import org.onap.sfc.entity.MsbRegisterEntity; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/api/microservices/v1/services") +public interface MsbService { + @Path("") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public MsbRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate, + MsbRegisterEntity entity)throws Exception; +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/SdnServiceConsumer.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/SdnServiceConsumer.java new file mode 100644 index 0000000..c44f9ee --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/SdnServiceConsumer.java @@ -0,0 +1,38 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.service; + +import com.eclipsesource.jaxrs.consumer.ConsumerFactory; +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class SdnServiceConsumer { + private static final Logger logger = LoggerFactory.getLogger(SdnServiceConsumer.class.getName()); + + public static ISdnControllerService getSdnConProxy(String url) throws Exception { + return ConsumerFactory.createConsumer(url, new ClientConfig().register(JacksonJsonProvider.class), + ISdnControllerService.class); + } + + public static MsbService getMsbRegisterService(String url) throws Exception { + return ConsumerFactory.createConsumer(url, new ClientConfig().register(JacksonJsonProvider.class), + MsbService.class); + } +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcConst.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcConst.java new file mode 100644 index 0000000..0a4a7e6 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcConst.java @@ -0,0 +1,24 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.utils; + +public interface SfcConst { + public static final int HTTP_OK = 200; + public static final int HTTP_POST_OK = 204; + public static final String SERVICE_NAME = "ztesdncdriver"; + public static final String SERVICE_URL="/api/ztesdncdriver/v1"; + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcDriverUtil.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcDriverUtil.java new file mode 100644 index 0000000..2b53a53 --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcDriverUtil.java @@ -0,0 +1,105 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.utils; + +import com.google.gson.Gson; +import org.onap.sfc.entity.ChainParameter; +import org.onap.sfc.entity.MsbRegisterEntity; +import org.onap.sfc.entity.NodeEntity; +import org.onap.sfc.entity.portpair.ServiceFunctionParameter; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +public class SfcDriverUtil { + + public static String generateUuid() { + return UUID.randomUUID().toString(); + + } + + public static ArrayList generateSfParams(Map sfHashParams) { + ArrayList serviceParameters = new ArrayList(); + if (sfHashParams != null) { + //serviceParameters.putAll(portPairReq4N.getSfParam()); + Set keySet = sfHashParams.keySet(); + Iterator iter = keySet.iterator(); + while (iter.hasNext()) { + String keyName = iter.next().toString(); + ServiceFunctionParameter sfParam = new ServiceFunctionParameter(); + sfParam.setServiceFunctionParamter(keyName); + sfParam.setGetServiceFunctionParamterValue(sfHashParams.get(keyName).toString()); + serviceParameters.add(sfParam); + } + } + return serviceParameters; + } + + public static ChainParameter generateChainParam(String key, String value) { + ChainParameter cp = new ChainParameter(); + cp.setChainParameter(key); + cp.setChainParamValue(value); + return cp; + } + + public static String toJson(Object obj) { + Gson gson = new Gson(); + return gson.toJson(obj); + } + + public static String generateAuthorization() { + String userName = "admin"; + String password = "admin"; + String usernameAndPassword = userName + ":" + password; +// String headName = "Authorization"; + return "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(usernameAndPassword.getBytes()); + } + + public static MsbRegisterEntity getMsbRegisterInfo() { + MsbRegisterEntity entity = new MsbRegisterEntity(); + entity.setServiceName(SfcConst.SERVICE_NAME); + entity.setVersion("v1"); + //entity.setUrl(SfcConst.SERVICE_URL); + entity.setUrl("/api/ztesdncdriver/v1"); + entity.setProtocol("REST"); + entity.setVisualRange("1"); + ArrayList nodes = new ArrayList(); + NodeEntity node = new NodeEntity(); + node.setIp(getLocalIp()); + node.setPort("8411"); + node.setTtl("1"); + nodes.add(node); + entity.setNodes(nodes); + return entity; + } + + public static String getLocalIp() + { + try { + InetAddress addr = InetAddress.getLocalHost(); + return addr.getHostAddress().toString(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + return ""; + } + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java new file mode 100644 index 0000000..e378aba --- /dev/null +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java @@ -0,0 +1,106 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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.onap.sfc.wrapper; + +import org.onap.sfc.entity.PortChainReq; +import org.onap.sfc.entity.PortChainReq4S; +import org.onap.sfc.entity.PortPairGroupReq; +import org.onap.sfc.entity.PortPairGroupReq4S; +import org.onap.sfc.utils.SfcDriverUtil; +import org.onap.sfc.entity.ChainParameter; +import org.onap.sfc.entity.FlowClassfierReq; +import org.onap.sfc.entity.FlowClassfierReq4N; +import org.onap.sfc.entity.FlowClassifierReq4S; +import org.onap.sfc.entity.PortChainReq4N; +import org.onap.sfc.entity.PortPairGroupReq4N; +import org.onap.sfc.entity.portpair.PortPairReq; +import org.onap.sfc.entity.portpair.PortPairReq4N; +import org.onap.sfc.entity.portpair.PortPairReq4S; +import org.onap.sfc.entity.portpair.ServiceFunctionParameter; + +import java.util.ArrayList; + + +public class N2sReqWrapper { + public static PortPairReq4S convertPortPair(PortPairReq4N portPairReq4N) { + PortPairReq portPairReq = new PortPairReq(); + portPairReq.setIngress(portPairReq4N.getIngress()); + portPairReq.setEgress(portPairReq4N.getEgress()); + ArrayList serviceFunctionParameters = new ArrayList(); + serviceFunctionParameters.addAll(SfcDriverUtil.generateSfParams(portPairReq4N.getSfParam())); + portPairReq.setServiceFunctionParameters(serviceFunctionParameters); + portPairReq.setUuid(SfcDriverUtil.generateUuid()); + ArrayList portPairList = new ArrayList(); + portPairList.add(portPairReq); + PortPairReq4S portPairReq4S = new PortPairReq4S(); + portPairReq4S.setPortPair(portPairList); + return portPairReq4S; + } + + public static PortPairGroupReq4S convertPortPairGroup(PortPairGroupReq4N ppg4N) { + PortPairGroupReq ppg4S = new PortPairGroupReq(); + ppg4S.setPortPairs(ppg4N.getPortPairs()); + ppg4S.setUuid(SfcDriverUtil.generateUuid()); + PortPairGroupReq4S portPairGroupReq4S = new PortPairGroupReq4S(); + ArrayList portPairGroupReqs = new ArrayList(); + portPairGroupReqs.add(ppg4S); + portPairGroupReq4S.setPortPairGroupReqs(portPairGroupReqs); + + return portPairGroupReq4S; + } + + public static FlowClassifierReq4S convertFlowClassfier(FlowClassfierReq4N flowClassfierReq4N) { + ArrayList flowClassifiers = new ArrayList(); + FlowClassfierReq flowClassfierReq = new FlowClassfierReq(); + flowClassfierReq.setProtocol(flowClassfierReq4N.getIp_proto()); +// flowClassfierReq.setSourcePortRangeMin(Integer.parseInt(flowClassfierReq4N. +// getSource_port_range().split(",")[0])); +// flowClassfierReq.setSourcePortRangeMax(Integer.parseInt(flowClassfierReq4N. +// getSource_port_range().split(",")[1])); +// flowClassfierReq.setDestinationPortRangeMin(Integer.parseInt( +// flowClassfierReq4N.getDest_port_range().split(",")[0])); +// flowClassfierReq.setDestinationPortRangeMax(Integer.parseInt( +// flowClassfierReq4N.getDest_port_range().split(",")[1])); + flowClassfierReq.setDestinationIpRange(flowClassfierReq4N.getDest_ip_range()); + flowClassfierReq.setSrcIpRange(flowClassfierReq4N.getSource_ip_range()); + flowClassfierReq.setIpDscp(flowClassfierReq4N.getDscp()); + flowClassfierReq.setUuid(SfcDriverUtil.generateUuid()); + flowClassifiers.add(flowClassfierReq); + FlowClassifierReq4S flowClassifierReq4S = new FlowClassifierReq4S(); + flowClassifierReq4S.setSfcFlowClassifier(flowClassifiers); + + return flowClassifierReq4S; + } + + public static PortChainReq4S converPortChain(PortChainReq4N portChainReq4N) { + PortChainReq portChainReq = new PortChainReq(); + portChainReq.setPortPairGroups(portChainReq4N.getPortPairGroups()); + portChainReq.setFlowClassifiers(portChainReq4N.getFlowClassifiers()); + portChainReq.setUuid(SfcDriverUtil.generateUuid()); + + ArrayList chainParam = new ArrayList(); + chainParam.add(SfcDriverUtil.generateChainParam("symmetric", portChainReq4N.isSymmetric() ? "true" : "false")); + portChainReq.setChainParams(chainParam); + ArrayList portChains = new ArrayList(); + portChains.add(portChainReq); + PortChainReq4S portChainReq4S = new PortChainReq4S(); + portChainReq4S.setPortChainReqs(portChains); + return portChainReq4S; + } + + +} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriver.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriver.java deleted file mode 100644 index b15c000..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriver.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc; - -import com.fasterxml.jackson.annotation.JsonInclude; -import io.dropwizard.Application; -import io.dropwizard.assets.AssetsBundle; -import io.dropwizard.server.SimpleServerFactory; -import io.dropwizard.setup.Bootstrap; -import io.dropwizard.setup.Environment; -import io.swagger.jaxrs.config.BeanConfig; -import io.swagger.jaxrs.listing.ApiListingResource; -import org.openo.sfc.health.ConsoleHealthCheck; -import org.openo.sfc.resources.DriverResource; -import org.openo.sfc.service.ConfigInfo; -import org.openo.sfc.resources.MsbServiceRegister; -import org.openo.sfc.utils.SfcConst; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SfcDriver extends Application { - - private static final Logger LOGGER = LoggerFactory.getLogger(SfcDriver.class); - - public static void main(String[] args) throws Exception { - new SfcDriver().run(args); - } - - @Override - public String getName() { - return SfcConst.SERVICE_NAME; - } - - @Override - public void initialize(Bootstrap bootstrap) { - bootstrap.addBundle(new AssetsBundle("/iui", "/", "index.html", "iui")); - bootstrap.addBundle(new AssetsBundle("/api-doc", "/api-doc", "index.html", "api-doc")); - } - - @Override - public void run(SfcDriverConfig configuration, - Environment environment) { - final DriverResource driverResource = new DriverResource(); - final ConsoleHealthCheck healthCheck = - new ConsoleHealthCheck(configuration.getTemplate()); - environment.healthChecks().register("template", healthCheck); - environment.jersey().register(driverResource); - ConfigInfo.setConfig(configuration); - - registerService(); - initSwaggerConfig(environment, configuration); - } - - - private void initSwaggerConfig(Environment environment, SfcDriverConfig configuration) { - environment.jersey().register(new ApiListingResource()); - environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); - - BeanConfig config = new BeanConfig(); - config.setTitle(" Console Service rest API"); - config.setVersion("1.0.0"); - config.setResourcePackage("org.openo.sfc.resources"); - //swagger rest api basepath - SimpleServerFactory simpleServerFactory = (SimpleServerFactory) configuration.getServerFactory(); - String basePath = simpleServerFactory.getApplicationContextPath(); - - basePath = basePath.endsWith("/") ? basePath : (new StringBuilder()).append(basePath).append('/').toString(); - basePath = basePath + "service"; - LOGGER.info("getApplicationContextPath: " + basePath); - config.setBasePath(basePath); - config.setScan(true); - } - - private void registerService() - { - Thread msbRegisterThread = new Thread(new MsbServiceRegister()); - msbRegisterThread.setName("Register Service 2 MSB"); - msbRegisterThread.start(); - } - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriverConfig.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriverConfig.java deleted file mode 100644 index 16f89ce..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/SfcDriverConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.dropwizard.Configuration; -import org.hibernate.validator.constraints.NotEmpty; - - -public class SfcDriverConfig extends Configuration { - @NotEmpty - private String template; - - @NotEmpty - private String defaultName = "Stranger"; - - @NotEmpty - private String msbServiceUrl; - - @JsonProperty - public String getTemplate() { - return template; - } - - @JsonProperty - public void setTemplate(String template) { - this.template = template; - } - - @JsonProperty - public String getDefaultName() { - return defaultName; - } - @JsonProperty - public void setDefaultName(String name) { - this.defaultName = name; - } - - public String getMsbServiceUrl() { - return msbServiceUrl; - } - - public void setMsbServiceUrl(String msbServiceUrl) { - this.msbServiceUrl = msbServiceUrl; - } - -} \ No newline at end of file diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/ChainParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/ChainParameter.java deleted file mode 100644 index f0efe0f..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/ChainParameter.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -public class ChainParameter { - @SerializedName("chain-parameter") - private String chainParameter; - @SerializedName("chain-parameter-value") - private String chainParamValue; - - public String getChainParameter() { - return chainParameter; - } - - public void setChainParameter(String chainParameter) { - this.chainParameter = chainParameter; - } - - public String getChainParamValue() { - return chainParamValue; - } - - public void setChainParamValue(String chainParamValue) { - this.chainParamValue = chainParamValue; - } - - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/DelReqInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/DelReqInfo.java deleted file mode 100644 index 94cbf9f..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/DelReqInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -public class DelReqInfo { - private String sdnControllerId; - private String url; - private String id; - - public String getSdnControllerId() { - return sdnControllerId; - } - - public void setSdnControllerId(String sdnControllerId) { - this.sdnControllerId = sdnControllerId; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq.java deleted file mode 100644 index 880c82c..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -public class FlowClassfierReq { - private String protocol; - @SerializedName("source-port-range-min") - private int sourcePortRangeMin; - @SerializedName("source-port-range-max") - private int sourcePortRangeMax; - @SerializedName("destination-port-range-min") - private int destinationPortRangeMin; - @SerializedName("destination-port-range-max") - private int destinationPortRangeMax; - @SerializedName("source-ip-range") - private String sourceIpRange; - @SerializedName("destination-ip-range") - private String destinationIpRange; - @SerializedName("ip-dscp") - private long ipDscp; - private String uuid; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public long getIpDscp() { - return ipDscp; - } - - public void setIpDscp(long ipDscp) { - this.ipDscp = ipDscp; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public int getSourcePortRangeMin() { - return sourcePortRangeMin; - } - - public void setSourcePortRangeMin(int sourcePortRangeMin) { - this.sourcePortRangeMin = sourcePortRangeMin; - } - - public int getSourcePortRangeMax() { - return sourcePortRangeMax; - } - - public void setSourcePortRangeMax(int sourcePortRangeMax) { - this.sourcePortRangeMax = sourcePortRangeMax; - } - - public int getDestinationPortRangeMin() { - return destinationPortRangeMin; - } - - public void setDestinationPortRangeMin(int destinationPortRangeMin) { - this.destinationPortRangeMin = destinationPortRangeMin; - } - - public int getDestinationPortRangeMax() { - return destinationPortRangeMax; - } - - public void setDestinationPortRangeMax(int destinationPortRangeMax) { - this.destinationPortRangeMax = destinationPortRangeMax; - } - - - public String getSrcIpRange() { - return sourceIpRange; - } - - public void setSrcIpRange(String srcIpRange) { - this.sourceIpRange = srcIpRange; - } - - public String getDestinationIpRange() { - return destinationIpRange; - } - - public void setDestinationIpRange(String destinationIpRange) { - this.destinationIpRange = destinationIpRange; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq4N.java deleted file mode 100644 index 75e94b2..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassfierReq4N.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -public class FlowClassfierReq4N { - private String url; - private String sdnControllerId; - private String name; - private String description; - private int dscp; - private String ip_proto; - private String source_port_range; - private String dest_port_range; - private String source_ip_range; - private String dest_ip_range; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getSdnControllerId() { - return sdnControllerId; - } - - public void setSdnControllerId(String sdnControllerId) { - this.sdnControllerId = sdnControllerId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getDscp() { - return dscp; - } - - public void setDscp(int dscp) { - this.dscp = dscp; - } - - public String getIp_proto() { - return ip_proto; - } - - public void setIp_proto(String ip_proto) { - this.ip_proto = ip_proto; - } - - public String getSource_port_range() { - return source_port_range; - } - - public void setSource_port_range(String source_port_range) { - this.source_port_range = source_port_range; - } - - public String getDest_port_range() { - return dest_port_range; - } - - public void setDest_port_range(String dest_port_range) { - this.dest_port_range = dest_port_range; - } - - public String getSource_ip_range() { - return source_ip_range; - } - - public void setSource_ip_range(String source_ip_range) { - this.source_ip_range = source_ip_range; - } - - public String getDest_ip_range() { - return dest_ip_range; - } - - public void setDest_ip_range(String dest_ip_range) { - this.dest_ip_range = dest_ip_range; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassifierReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassifierReq4S.java deleted file mode 100644 index 587d7a6..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/FlowClassifierReq4S.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; - -public class FlowClassifierReq4S { - public ArrayList getSfcFlowClassifier() { - return sfcFlowClassifier; - } - - public void setSfcFlowClassifier(ArrayList sfcFlowClassifier) { - this.sfcFlowClassifier = sfcFlowClassifier; - } - - @SerializedName("sfc-flow-classifier") - ArrayList sfcFlowClassifier; - - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/MsbRegisterEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/MsbRegisterEntity.java deleted file mode 100644 index 6417b02..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/MsbRegisterEntity.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -import java.util.ArrayList; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class MsbRegisterEntity { - private String serviceName; - private String version; - private String url; - private String protocol; - private String visualRange; - private ArrayList nodes; - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getVisualRange() { - return visualRange; - } - - public void setVisualRange(String visualRange) { - this.visualRange = visualRange; - } - - public ArrayList getNodes() { - return nodes; - } - - public void setNodes(ArrayList nodes) { - this.nodes = nodes; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/NodeEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/NodeEntity.java deleted file mode 100644 index bfba99d..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/NodeEntity.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class NodeEntity { - private String ip; - private String port; - private String ttl; - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - - public String getTtl() { - return ttl; - } - - public void setTtl(String ttl) { - this.ttl = ttl; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq.java deleted file mode 100644 index 4dfc9a3..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; -import java.util.Map; - -public class PortChainReq { - @SerializedName("port-pair-groups") - private ArrayList portPairGroups; - @SerializedName("flow-classifiers") - private ArrayList flowClassifiers; - private String uuid; - @SerializedName("chain-parameters") - private ArrayList chainParams; - - - public ArrayList getChainParams() { - return chainParams; - } - - public void setChainParams(ArrayList chainParams) { - this.chainParams = chainParams; - } - - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - private Map chainParameters; - - public ArrayList getPortPairGroups() { - return portPairGroups; - } - - public void setPortPairGroups(ArrayList portPairGroups) { - this.portPairGroups = portPairGroups; - } - - public ArrayList getFlowClassifiers() { - return flowClassifiers; - } - - public void setFlowClassifiers(ArrayList flowClassifiers) { - this.flowClassifiers = flowClassifiers; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4N.java deleted file mode 100644 index 6457d0e..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4N.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import java.util.ArrayList; - -public class PortChainReq4N { - private String sdnControllerId; - private String url; - private String name; - private String description; - private ArrayList flowClassifiers; - private ArrayList portPairGroups; - private boolean symmetric; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getSdnControllerId() { - return sdnControllerId; - } - - public void setSdnControllerId(String sdnControllerId) { - this.sdnControllerId = sdnControllerId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public ArrayList getFlowClassifiers() { - return flowClassifiers; - } - - public void setFlowClassifiers(ArrayList flowClassifiers) { - this.flowClassifiers = flowClassifiers; - } - - public ArrayList getPortPairGroups() { - return portPairGroups; - } - - public void setPortPairGroups(ArrayList portPairGroups) { - this.portPairGroups = portPairGroups; - } - - public boolean isSymmetric() { - return symmetric; - } - - public void setSymmetric(boolean symmetric) { - this.symmetric = symmetric; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4S.java deleted file mode 100644 index 05d04c6..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortChainReq4S.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; - -public class PortChainReq4S { - - public ArrayList getPortChainReqs() { - return portChainReqs; - } - - public void setPortChainReqs(ArrayList portChainReqs) { - this.portChainReqs = portChainReqs; - } - - @SerializedName("port-chain") - ArrayList portChainReqs; -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq.java deleted file mode 100644 index 4dff87a..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -import java.util.List; - - -public class PortPairGroupReq { - private String uuid; - @SerializedName("port-pairs") - List portPairs; - - public List getPortPairs() { - return portPairs; - } - - public void setPortPairs(List portPairs) { - this.portPairs = portPairs; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4N.java deleted file mode 100644 index 393fe13..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4N.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import java.util.List; - - -public class PortPairGroupReq4N { - String sdnControllerId; - String url; - String name; - String description; - List portPairs; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public String getSdnControllerId() { - return sdnControllerId; - } - - public void setSdnControllerId(String sdnControllerId) { - this.sdnControllerId = sdnControllerId; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getPortPairs() { - return portPairs; - } - - public void setPortPairs(List portPairs) { - this.portPairs = portPairs; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4S.java deleted file mode 100644 index c52a3ef..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/PortPairGroupReq4S.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; - -public class PortPairGroupReq4S { - public ArrayList getPortPairGroupReqs() { - return portPairGroupReqs; - } - - public void setPortPairGroupReqs(ArrayList portPairGroupReqs) { - this.portPairGroupReqs = portPairGroupReqs; - } - - @SerializedName("port-pair-group") - ArrayList portPairGroupReqs; -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/Result.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/Result.java deleted file mode 100644 index bb4f2ac..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/Result.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -public class Result { - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - private String id; - - public Result(String uuid) { - this.id = uuid; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/SdnControllerInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/SdnControllerInfo.java deleted file mode 100644 index 733971e..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/SdnControllerInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity; - -public class SdnControllerInfo { - String url; - String userName; - String password; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortInfo.java deleted file mode 100644 index 996b799..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortInfo.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity.portpair; - - -import com.google.gson.annotations.SerializedName; - -public class PortInfo { - private String encapsulation; - private String ip; - private String mac; - @SerializedName("port-name") - private String portName; - - public String getEncapsulation() { - return encapsulation; - } - - - public String getPortName() { - return portName; - } - - public void setPortName(String portName) { - this.portName = portName; - } - - public void setEncapsulation(String encapsulation) { - this.encapsulation = encapsulation; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getMac() { - return mac; - } - - public void setMac(String mac) { - this.mac = mac; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq.java deleted file mode 100644 index d4766c1..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity.portpair; - -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; - - -public class PortPairReq { - private String uuid; - private PortInfo ingress; - private PortInfo egress; - @SerializedName("service-function-parameters") - private ArrayList serviceFunctionParameters; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public ArrayList getServiceFunctionParameters() { - return serviceFunctionParameters; - } - - public void setServiceFunctionParameters(ArrayList serviceFunctionParameters) { - this.serviceFunctionParameters = serviceFunctionParameters; - } - - public PortInfo getIngress() { - return ingress; - } - - public void setIngress(PortInfo ingress) { - this.ingress = ingress; - } - - public PortInfo getEgress() { - return egress; - } - - public void setEgress(PortInfo egress) { - this.egress = egress; - } - - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4N.java deleted file mode 100644 index e4346e5..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4N.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity.portpair; - -import java.util.Map; - - -public class PortPairReq4N { - private String sdnControllerId; - private String url; - private String name; - private String description; - private String sfType; - private boolean nshAware; - private boolean requestReclassification; - private PortInfo ingress; - private PortInfo egress; - private Map sfParam; - - public String getSdnControllerId() { - return sdnControllerId; - } - - public void setSdnControllerId(String sdnControllerId) { - this.sdnControllerId = sdnControllerId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getSfType() { - return sfType; - } - - public void setSfType(String sfType) { - this.sfType = sfType; - } - - public boolean isNshAware() { - return nshAware; - } - - public void setNshAware(boolean nshAware) { - this.nshAware = nshAware; - } - - public boolean isRequestReclassification() { - return requestReclassification; - } - - public void setRequestReclassification(boolean requestReclassification) { - this.requestReclassification = requestReclassification; - } - - public PortInfo getIngress() { - return ingress; - } - - public void setIngress(PortInfo ingress) { - this.ingress = ingress; - } - - public PortInfo getEgress() { - return egress; - } - - public void setEgress(PortInfo egress) { - this.egress = egress; - } - - public Map getSfParam() { - return sfParam; - } - - public void setSfParam(Map sfParam) { - this.sfParam = sfParam; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4S.java deleted file mode 100644 index 6218480..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/PortPairReq4S.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity.portpair; - -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; - -public class PortPairReq4S { - public ArrayList getPortPair() { - return portPair; - } - - public void setPortPair(ArrayList portPair) { - this.portPair = portPair; - } - - @SerializedName("port-pair") - ArrayList portPair; - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/ServiceFunctionParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/ServiceFunctionParameter.java deleted file mode 100644 index c1c384c..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/entity/portpair/ServiceFunctionParameter.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.entity.portpair; - -import com.google.gson.annotations.SerializedName; - -public class ServiceFunctionParameter { - @SerializedName("service-function-parameter") - private String serviceFunctionParamter; - @SerializedName("service-function-parameter-value") - private String getServiceFunctionParamterValue; - - public String getServiceFunctionParamter() { - return serviceFunctionParamter; - } - - public void setServiceFunctionParamter(String serviceFunctionParamter) { - this.serviceFunctionParamter = serviceFunctionParamter; - } - - public String getGetServiceFunctionParamterValue() { - return getServiceFunctionParamterValue; - } - - public void setGetServiceFunctionParamterValue(String getServiceFunctionParamterValue) { - this.getServiceFunctionParamterValue = getServiceFunctionParamterValue; - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/health/ConsoleHealthCheck.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/health/ConsoleHealthCheck.java deleted file mode 100644 index 81877a3..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/health/ConsoleHealthCheck.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.health; - -import com.codahale.metrics.health.HealthCheck; - -public class ConsoleHealthCheck extends HealthCheck { - private final String template; - - public ConsoleHealthCheck(String template) { - this.template = template; - } - - @Override - protected Result check() throws Exception { - final String saying = String.format(template, "TEST"); - if (!saying.contains("TEST")) { - return Result.unhealthy("template doesn't include a name"); - } - return Result.healthy(); - } -} \ No newline at end of file diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/DriverResource.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/DriverResource.java deleted file mode 100644 index e7b6e86..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/DriverResource.java +++ /dev/null @@ -1,214 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.resources; - -import com.codahale.metrics.annotation.Timed; -import org.openo.sfc.entity.DelReqInfo; -import org.openo.sfc.entity.FlowClassfierReq4N; -import org.openo.sfc.entity.FlowClassifierReq4S; -import org.openo.sfc.entity.PortChainReq4N; -import org.openo.sfc.entity.PortChainReq4S; -import org.openo.sfc.entity.PortPairGroupReq4N; -import org.openo.sfc.entity.PortPairGroupReq4S; -import org.openo.sfc.entity.Result; -import org.openo.sfc.entity.portpair.PortPairReq4N; -import org.openo.sfc.entity.portpair.PortPairReq4S; -import org.openo.sfc.service.SdnServiceConsumer; -import org.openo.sfc.utils.SfcDriverUtil; -import org.openo.sfc.wrapper.N2sReqWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.ws.rs.DELETE; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -@Path("/") -public class DriverResource { - private static final Logger LOGGER = LoggerFactory.getLogger(DriverResource.class); -// -// @POST -// @Path("/checksdncontroller") -// @Produces(MediaType.APPLICATION_JSON) -// @Timed -// public Result checkSdnController(SdnControllerInfo sdnInfo) -// throws Exception { -// if (sdnInfo == null ) { -// throw new NotFoundException("SdnControllerInfo is null"); -// } -// return SdnServiceConsumer.getSdnConProxy(sdnInfo.getUrl()).querySdnController(); -// } - - @POST - @Path("/createportpair") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public Result createPortPair(PortPairReq4N portPairReq4N) - throws Exception { - if (portPairReq4N == null) { - throw new NotFoundException("SdnControllerInfo is null"); - } - LOGGER.info(SfcDriverUtil.toJson(portPairReq4N)); - PortPairReq4S portPairReq = N2sReqWrapper.convertPortPair(portPairReq4N); - String portPairReqJson = SfcDriverUtil.toJson(portPairReq); - LOGGER.info(portPairReqJson); - SdnServiceConsumer.getSdnConProxy(portPairReq4N.getUrl()).createPortPair(SfcDriverUtil.generateAuthorization(), portPairReqJson); -// -// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) -// { -// return new Result(portPairReq.getPortPair().get(0).getUuid()); -// } -// return rsp; - - return new Result(portPairReq.getPortPair().get(0).getUuid()); - } - - @POST - @Path("/createportpairgroup") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public Result createPortPairGroup(PortPairGroupReq4N portPairGroupReq4N) - throws Exception { - if (portPairGroupReq4N == null) { - throw new NotFoundException("SdnControllerInfo is null"); - } - LOGGER.info(SfcDriverUtil.toJson(portPairGroupReq4N)); - PortPairGroupReq4S portPairGroupReq4S = N2sReqWrapper.convertPortPairGroup(portPairGroupReq4N); - String portPairGroupReqJson = SfcDriverUtil.toJson(portPairGroupReq4S); - LOGGER.info(portPairGroupReqJson); - SdnServiceConsumer.getSdnConProxy(portPairGroupReq4N.getUrl()).createPortPairGroup( - SfcDriverUtil.generateAuthorization(), portPairGroupReqJson); -// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) -// { -// return new Result(portPairGroupReq4S.getPortPairGroupReqs().get(0).getUuid()); -// } -// -// return rsp; - - return new Result(portPairGroupReq4S.getPortPairGroupReqs().get(0).getUuid()); - - } - - @POST - @Path("/createflowclassfier") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public Result createFlowClassfier(FlowClassfierReq4N flowClassfierReq4N) - throws Exception { - if (flowClassfierReq4N == null) { - throw new NotFoundException("FlowClassfierReq4N is null"); - } - LOGGER.info(SfcDriverUtil.toJson(flowClassfierReq4N)); - FlowClassifierReq4S flowClassfierReq4S = N2sReqWrapper. - convertFlowClassfier(flowClassfierReq4N); - String uuid = flowClassfierReq4S.getSfcFlowClassifier().get(0).getUuid(); - String flowClassifierJson = SfcDriverUtil.toJson(flowClassfierReq4S); - LOGGER.info(flowClassifierJson); - SdnServiceConsumer.getSdnConProxy(flowClassfierReq4N.getUrl()).createFlowCla(SfcDriverUtil.generateAuthorization(), flowClassifierJson); -// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) -// { -// return new Result(uuid); -// } -// else -// return rsp; - - return new Result(uuid); - } - - @POST - @Path("/createportchain") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public Result creatPortChain(PortChainReq4N portChainReq4N) - throws Exception { - if (portChainReq4N == null) { - throw new NotFoundException("PortChainReq4N is null"); - } - LOGGER.info(SfcDriverUtil.toJson(portChainReq4N)); - PortChainReq4S portChainReq = N2sReqWrapper.converPortChain(portChainReq4N); - String portChainReqJson = SfcDriverUtil.toJson(portChainReq); - LOGGER.info(portChainReqJson); - SdnServiceConsumer.getSdnConProxy(portChainReq4N.getUrl()).createPortChain( - SfcDriverUtil.generateAuthorization(), portChainReqJson); -// if(rsp.getStatus() == SfcConst.HTTP_POST_OK) -// { -// return new Result(portChainReq.getPortChainReqs().get(0).getUuid()); -// } -// return rsp; - - return new Result(portChainReq.getPortChainReqs().get(0).getUuid()); - - } - - @DELETE - @Path("/delportpair") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public void delPortPair(DelReqInfo delReqInfo) - throws Exception { - if (delReqInfo == null) { - throw new NotFoundException("DelReqInfo is null"); - } - LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); - SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deletePortPair(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); - - } - - @DELETE - @Path("/delportpairgroup") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public void delPortPairGroup(DelReqInfo delReqInfo) - throws Exception { - if (delReqInfo == null) { - throw new NotFoundException("DelReqInfo is null"); - } - LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); - SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deletePortPairGroup(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); - - } - - @DELETE - @Path("/delclassifier") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public void delFlowClassfier(DelReqInfo delReqInfo) - throws Exception { - if (delReqInfo == null) { - throw new NotFoundException("DelReqInfo is null"); - } - LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); - SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deleteFlowClassifiers(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); - - } - - @DELETE - @Path("/delchain") - @Produces(MediaType.APPLICATION_JSON) - @Timed - public void delPortChain(DelReqInfo delReqInfo) - throws Exception { - if (delReqInfo == null) { - throw new NotFoundException("DelReqInfo is null"); - } - LOGGER.info(SfcDriverUtil.toJson(delReqInfo)); - SdnServiceConsumer.getSdnConProxy(delReqInfo.getUrl()).deletePortChain(SfcDriverUtil.generateAuthorization(), delReqInfo.getId()); - - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/MsbServiceRegister.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/MsbServiceRegister.java deleted file mode 100644 index db98697..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/resources/MsbServiceRegister.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.resources; - -import com.google.gson.Gson; -import org.openo.sfc.entity.MsbRegisterEntity; -import org.openo.sfc.service.ConfigInfo; -import org.openo.sfc.service.SdnServiceConsumer; -import org.openo.sfc.utils.SfcDriverUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MsbServiceRegister implements Runnable { - private final Logger LOGGER = LoggerFactory.getLogger(MsbServiceRegister.class); - MsbRegisterEntity entity; - public MsbServiceRegister() - { - initInfo(); - } - - private void initInfo() - { - entity = SfcDriverUtil.getMsbRegisterInfo(); - - } - - @Override - public void run() { - boolean flag = false; - int retryTimes=0; - while (!flag && retryTimes<20) - { - try { - LOGGER.info("Register Msb start:"); - LOGGER.info(SfcDriverUtil.toJson(entity)); - SdnServiceConsumer.getMsbRegisterService(ConfigInfo.getConfig().getMsbServiceUrl()). - registerServce("false",entity); - LOGGER.info("Register Msb end:"); - flag = true; - break; - } catch (Exception e) { - LOGGER.info("Register Msb failed"); - e.printStackTrace(); - threadSleep(30000); - } - } - - } - - private void threadSleep(int second) { - LOGGER.info("start sleep ...."); - try { - Thread.sleep(second); - } catch (InterruptedException error) { - LOGGER.error("thread sleep error.errorMsg:" + error.getMessage()); - } - LOGGER.info("sleep end ."); - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ConfigInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ConfigInfo.java deleted file mode 100644 index 9d0fee1..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ConfigInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.service; - -import org.openo.sfc.SfcDriverConfig; - -public class ConfigInfo { - public static SfcDriverConfig getConfig() { - return config; - } - - public static void setConfig(SfcDriverConfig sfcDriverConfig) { - config = sfcDriverConfig; - } - - private static SfcDriverConfig config; -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ISdnControllerService.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ISdnControllerService.java deleted file mode 100644 index 77d470b..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/ISdnControllerService.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.service; - -import org.openo.sfc.entity.Result; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -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; - - -@Path("/restconf/config/neutron:neutron") -public interface ISdnControllerService { - - @Path("/") - @GET - @Produces(MediaType.APPLICATION_JSON) - public Result querySdnController() throws Exception; - - @Path("/port-pairs") - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - public Response createPortPair(@HeaderParam("Authorization") String authorization, String portPairReq4S) throws Exception; - - @Path("/port-pair-groups") - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - public Response createPortPairGroup(@HeaderParam("Authorization") String authorization, String ppg4S) throws Exception; - - @Path("/sfc-flow-classifiers") - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - public Response createFlowCla(@HeaderParam("Authorization") String authorization, String flowClassfierReq) throws Exception; - - - @Path("/port-chains") - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - public Response createPortChain(@HeaderParam("Authorization") String authorization, String portChainReq4S) throws Exception; - - @Path("/port-pairs/port-pair/{id}") - @DELETE - @Produces(MediaType.APPLICATION_JSON) - public Response deletePortPair(@HeaderParam("Authorization") String authorization, @PathParam("id") String id) throws Exception; - - - @Path("/port-pair-groups/port-pair-group/{id}") - @DELETE - @Produces(MediaType.APPLICATION_JSON) - public Response deletePortPairGroup(@HeaderParam("Authorization") String authorization, @PathParam("id") String uuid) throws Exception; - - @Path("/sfc-flow-classifiers/sfc-flow-classifier/{id}") - @DELETE - @Produces(MediaType.APPLICATION_JSON) - public Response deleteFlowClassifiers(@HeaderParam("Authorization") String authorization, @PathParam("id") String id) throws Exception; - - @Path("/port-chains/port-chain/{id}") - @DELETE - @Produces(MediaType.APPLICATION_JSON) - public Response deletePortChain(@HeaderParam("Authorization") String authorization, @PathParam("id") String id) throws Exception; - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/MsbService.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/MsbService.java deleted file mode 100644 index 6aaff1f..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/MsbService.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.service; - -import org.openo.sfc.entity.MsbRegisterEntity; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -@Path("/api/microservices/v1/services") -public interface MsbService { - @Path("") - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public MsbRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate, - MsbRegisterEntity entity)throws Exception; -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/SdnServiceConsumer.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/SdnServiceConsumer.java deleted file mode 100644 index dc59694..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/service/SdnServiceConsumer.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.service; - -import com.eclipsesource.jaxrs.consumer.ConsumerFactory; -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; -import org.glassfish.jersey.client.ClientConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class SdnServiceConsumer { - private static final Logger logger = LoggerFactory.getLogger(SdnServiceConsumer.class.getName()); - - public static ISdnControllerService getSdnConProxy(String url) throws Exception { - return ConsumerFactory.createConsumer(url, new ClientConfig().register(JacksonJsonProvider.class), - ISdnControllerService.class); - } - - public static MsbService getMsbRegisterService(String url) throws Exception { - return ConsumerFactory.createConsumer(url, new ClientConfig().register(JacksonJsonProvider.class), - MsbService.class); - } -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcConst.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcConst.java deleted file mode 100644 index 2ddd5bd..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcConst.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.utils; - -public interface SfcConst { - public static final int HTTP_OK = 200; - public static final int HTTP_POST_OK = 204; - public static final String SERVICE_NAME = "ztesdncdriver"; - public static final String SERVICE_URL="/api/ztesdncdriver/v1"; - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcDriverUtil.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcDriverUtil.java deleted file mode 100644 index 5752092..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/utils/SfcDriverUtil.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.utils; - -import com.google.gson.Gson; -import org.openo.sfc.entity.ChainParameter; -import org.openo.sfc.entity.MsbRegisterEntity; -import org.openo.sfc.entity.NodeEntity; -import org.openo.sfc.entity.portpair.ServiceFunctionParameter; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -public class SfcDriverUtil { - - public static String generateUuid() { - return UUID.randomUUID().toString(); - - } - - public static ArrayList generateSfParams(Map sfHashParams) { - ArrayList serviceParameters = new ArrayList(); - if (sfHashParams != null) { - //serviceParameters.putAll(portPairReq4N.getSfParam()); - Set keySet = sfHashParams.keySet(); - Iterator iter = keySet.iterator(); - while (iter.hasNext()) { - String keyName = iter.next().toString(); - ServiceFunctionParameter sfParam = new ServiceFunctionParameter(); - sfParam.setServiceFunctionParamter(keyName); - sfParam.setGetServiceFunctionParamterValue(sfHashParams.get(keyName).toString()); - serviceParameters.add(sfParam); - } - } - return serviceParameters; - } - - public static ChainParameter generateChainParam(String key, String value) { - ChainParameter cp = new ChainParameter(); - cp.setChainParameter(key); - cp.setChainParamValue(value); - return cp; - } - - public static String toJson(Object obj) { - Gson gson = new Gson(); - return gson.toJson(obj); - } - - public static String generateAuthorization() { - String userName = "admin"; - String password = "admin"; - String usernameAndPassword = userName + ":" + password; -// String headName = "Authorization"; - return "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(usernameAndPassword.getBytes()); - } - - public static MsbRegisterEntity getMsbRegisterInfo() { - MsbRegisterEntity entity = new MsbRegisterEntity(); - entity.setServiceName(SfcConst.SERVICE_NAME); - entity.setVersion("v1"); - //entity.setUrl(SfcConst.SERVICE_URL); - entity.setUrl("/api/ztesdncdriver/v1"); - entity.setProtocol("REST"); - entity.setVisualRange("1"); - ArrayList nodes = new ArrayList(); - NodeEntity node = new NodeEntity(); - node.setIp(getLocalIp()); - node.setPort("8411"); - node.setTtl("1"); - nodes.add(node); - entity.setNodes(nodes); - return entity; - } - - public static String getLocalIp() - { - try { - InetAddress addr = InetAddress.getLocalHost(); - return addr.getHostAddress().toString(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - return ""; - } - -} diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/wrapper/N2sReqWrapper.java b/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/wrapper/N2sReqWrapper.java deleted file mode 100644 index 0ad7d1b..0000000 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/openo/sfc/wrapper/N2sReqWrapper.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright 2016 ZTE Corporation. - * - * 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.openo.sfc.wrapper; - -import org.openo.sfc.entity.ChainParameter; -import org.openo.sfc.entity.FlowClassfierReq; -import org.openo.sfc.entity.FlowClassfierReq4N; -import org.openo.sfc.entity.FlowClassifierReq4S; -import org.openo.sfc.entity.PortChainReq; -import org.openo.sfc.entity.PortChainReq4N; -import org.openo.sfc.entity.PortChainReq4S; -import org.openo.sfc.entity.PortPairGroupReq; -import org.openo.sfc.entity.PortPairGroupReq4N; -import org.openo.sfc.entity.PortPairGroupReq4S; -import org.openo.sfc.entity.portpair.PortPairReq; -import org.openo.sfc.entity.portpair.PortPairReq4N; -import org.openo.sfc.entity.portpair.PortPairReq4S; -import org.openo.sfc.entity.portpair.ServiceFunctionParameter; -import org.openo.sfc.utils.SfcDriverUtil; - -import java.util.ArrayList; - - -public class N2sReqWrapper { - public static PortPairReq4S convertPortPair(PortPairReq4N portPairReq4N) { - PortPairReq portPairReq = new PortPairReq(); - portPairReq.setIngress(portPairReq4N.getIngress()); - portPairReq.setEgress(portPairReq4N.getEgress()); - ArrayList serviceFunctionParameters = new ArrayList(); - serviceFunctionParameters.addAll(SfcDriverUtil.generateSfParams(portPairReq4N.getSfParam())); - portPairReq.setServiceFunctionParameters(serviceFunctionParameters); - portPairReq.setUuid(SfcDriverUtil.generateUuid()); - ArrayList portPairList = new ArrayList(); - portPairList.add(portPairReq); - PortPairReq4S portPairReq4S = new PortPairReq4S(); - portPairReq4S.setPortPair(portPairList); - return portPairReq4S; - } - - public static PortPairGroupReq4S convertPortPairGroup(PortPairGroupReq4N ppg4N) { - PortPairGroupReq ppg4S = new PortPairGroupReq(); - ppg4S.setPortPairs(ppg4N.getPortPairs()); - ppg4S.setUuid(SfcDriverUtil.generateUuid()); - PortPairGroupReq4S portPairGroupReq4S = new PortPairGroupReq4S(); - ArrayList portPairGroupReqs = new ArrayList(); - portPairGroupReqs.add(ppg4S); - portPairGroupReq4S.setPortPairGroupReqs(portPairGroupReqs); - - return portPairGroupReq4S; - } - - public static FlowClassifierReq4S convertFlowClassfier(FlowClassfierReq4N flowClassfierReq4N) { - ArrayList flowClassifiers = new ArrayList(); - FlowClassfierReq flowClassfierReq = new FlowClassfierReq(); - flowClassfierReq.setProtocol(flowClassfierReq4N.getIp_proto()); -// flowClassfierReq.setSourcePortRangeMin(Integer.parseInt(flowClassfierReq4N. -// getSource_port_range().split(",")[0])); -// flowClassfierReq.setSourcePortRangeMax(Integer.parseInt(flowClassfierReq4N. -// getSource_port_range().split(",")[1])); -// flowClassfierReq.setDestinationPortRangeMin(Integer.parseInt( -// flowClassfierReq4N.getDest_port_range().split(",")[0])); -// flowClassfierReq.setDestinationPortRangeMax(Integer.parseInt( -// flowClassfierReq4N.getDest_port_range().split(",")[1])); - flowClassfierReq.setDestinationIpRange(flowClassfierReq4N.getDest_ip_range()); - flowClassfierReq.setSrcIpRange(flowClassfierReq4N.getSource_ip_range()); - flowClassfierReq.setIpDscp(flowClassfierReq4N.getDscp()); - flowClassfierReq.setUuid(SfcDriverUtil.generateUuid()); - flowClassifiers.add(flowClassfierReq); - FlowClassifierReq4S flowClassifierReq4S = new FlowClassifierReq4S(); - flowClassifierReq4S.setSfcFlowClassifier(flowClassifiers); - - return flowClassifierReq4S; - } - - public static PortChainReq4S converPortChain(PortChainReq4N portChainReq4N) { - PortChainReq portChainReq = new PortChainReq(); - portChainReq.setPortPairGroups(portChainReq4N.getPortPairGroups()); - portChainReq.setFlowClassifiers(portChainReq4N.getFlowClassifiers()); - portChainReq.setUuid(SfcDriverUtil.generateUuid()); - - ArrayList chainParam = new ArrayList(); - chainParam.add(SfcDriverUtil.generateChainParam("symmetric", portChainReq4N.isSymmetric() ? "true" : "false")); - portChainReq.setChainParams(chainParam); - ArrayList portChains = new ArrayList(); - portChains.add(portChainReq); - PortChainReq4S portChainReq4S = new PortChainReq4S(); - portChainReq4S.setPortChainReqs(portChains); - return portChainReq4S; - } - - -} diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestAuthorization.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestAuthorization.java index 71c1a34..65f2a61 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestAuthorization.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestAuthorization.java @@ -17,7 +17,7 @@ package org.onap.sfc; import org.junit.Before; import org.junit.Test; -import org.openo.sfc.utils.SfcDriverUtil; +import org.onap.sfc.utils.SfcDriverUtil; public class TestAuthorization { @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestFlowClassifier.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestFlowClassifier.java index dbe2552..ecaa984 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestFlowClassifier.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestFlowClassifier.java @@ -17,9 +17,9 @@ package org.onap.sfc; import org.junit.Before; import org.junit.Test; -import org.openo.sfc.entity.FlowClassfierReq4N; -import org.openo.sfc.utils.SfcDriverUtil; -import org.openo.sfc.wrapper.N2sReqWrapper; +import org.onap.sfc.entity.FlowClassfierReq4N; +import org.onap.sfc.utils.SfcDriverUtil; +import org.onap.sfc.wrapper.N2sReqWrapper; public class TestFlowClassifier { diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java index 1883728..f19d28a 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestMsbRegister.java @@ -17,8 +17,8 @@ package org.onap.sfc; import org.junit.Before; import org.junit.Test; -import org.openo.sfc.entity.MsbRegisterEntity; -import org.openo.sfc.utils.SfcDriverUtil; +import org.onap.sfc.entity.MsbRegisterEntity; +import org.onap.sfc.utils.SfcDriverUtil; public class TestMsbRegister { @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortChain.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortChain.java index 1643067..4c785d6 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortChain.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortChain.java @@ -17,8 +17,8 @@ package org.onap.sfc; import org.junit.Before; import org.junit.Test; -import org.openo.sfc.entity.PortChainReq4N; -import org.openo.sfc.wrapper.N2sReqWrapper; +import org.onap.sfc.entity.PortChainReq4N; +import org.onap.sfc.wrapper.N2sReqWrapper; public class TestPortChain { @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPair.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPair.java index 060e3a2..f205651 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPair.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPair.java @@ -19,10 +19,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.openo.sfc.entity.portpair.PortPairReq4N; -import org.openo.sfc.resources.DriverResource; -import org.openo.sfc.service.ISdnControllerService; -import org.openo.sfc.wrapper.N2sReqWrapper; +import org.onap.sfc.entity.portpair.PortPairReq4N; +import org.onap.sfc.resources.DriverResource; +import org.onap.sfc.service.ISdnControllerService; +import org.onap.sfc.wrapper.N2sReqWrapper; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPairGroup.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPairGroup.java index bd4caf2..a343952 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPairGroup.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestPortPairGroup.java @@ -18,9 +18,9 @@ package org.onap.sfc; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.openo.sfc.entity.PortPairGroupReq4N; -import org.openo.sfc.service.ISdnControllerService; -import org.openo.sfc.wrapper.N2sReqWrapper; +import org.onap.sfc.entity.PortPairGroupReq4N; +import org.onap.sfc.service.ISdnControllerService; +import org.onap.sfc.wrapper.N2sReqWrapper; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestSfParams.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestSfParams.java index 0b5b850..0cd07ab 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestSfParams.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/TestSfParams.java @@ -17,8 +17,8 @@ package org.onap.sfc; import org.junit.Before; import org.junit.Test; -import org.openo.sfc.entity.ChainParameter; -import org.openo.sfc.utils.SfcDriverUtil; +import org.onap.sfc.entity.ChainParameter; +import org.onap.sfc.utils.SfcDriverUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -- cgit 1.2.3-korg