summaryrefslogtreecommitdiffstats
path: root/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc
diff options
context:
space:
mode:
Diffstat (limited to 'zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc')
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriver.java94
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/SfcDriverConfig.java61
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java43
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/DelReqInfo.java46
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq.java110
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java109
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java35
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java78
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java49
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java67
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java84
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java34
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq.java44
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4N.java68
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortPairGroupReq4S.java33
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java32
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java47
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java61
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq.java63
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4N.java112
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortPairReq4S.java34
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java41
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/health/ConsoleHealthCheck.java35
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/DriverResource.java214
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/resources/MsbServiceRegister.java71
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ConfigInfo.java30
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/ISdnControllerService.java87
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/MsbService.java35
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/service/SdnServiceConsumer.java38
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcConst.java24
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/utils/SfcDriverUtil.java105
-rw-r--r--zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java106
32 files changed, 2090 insertions, 0 deletions
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<SfcDriverConfig> {
+
+ 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<SfcDriverConfig> 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<FlowClassfierReq> getSfcFlowClassifier() {
+ return sfcFlowClassifier;
+ }
+
+ public void setSfcFlowClassifier(ArrayList<FlowClassfierReq> sfcFlowClassifier) {
+ this.sfcFlowClassifier = sfcFlowClassifier;
+ }
+
+ @SerializedName("sfc-flow-classifier")
+ ArrayList<FlowClassfierReq> 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<NodeEntity> 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<NodeEntity> getNodes() {
+ return nodes;
+ }
+
+ public void setNodes(ArrayList<NodeEntity> 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<String> portPairGroups;
+ @SerializedName("flow-classifiers")
+ private ArrayList<String> flowClassifiers;
+ private String uuid;
+ @SerializedName("chain-parameters")
+ private ArrayList<ChainParameter> chainParams;
+
+
+ public ArrayList<ChainParameter> getChainParams() {
+ return chainParams;
+ }
+
+ public void setChainParams(ArrayList<ChainParameter> chainParams) {
+ this.chainParams = chainParams;
+ }
+
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ private Map chainParameters;
+
+ public ArrayList<String> getPortPairGroups() {
+ return portPairGroups;
+ }
+
+ public void setPortPairGroups(ArrayList<String> portPairGroups) {
+ this.portPairGroups = portPairGroups;
+ }
+
+ public ArrayList<String> getFlowClassifiers() {
+ return flowClassifiers;
+ }
+
+ public void setFlowClassifiers(ArrayList<String> 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<String> flowClassifiers;
+ private ArrayList<String> 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<String> getFlowClassifiers() {
+ return flowClassifiers;
+ }
+
+ public void setFlowClassifiers(ArrayList<String> flowClassifiers) {
+ this.flowClassifiers = flowClassifiers;
+ }
+
+ public ArrayList<String> getPortPairGroups() {
+ return portPairGroups;
+ }
+
+ public void setPortPairGroups(ArrayList<String> 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<PortChainReq> getPortChainReqs() {
+ return portChainReqs;
+ }
+
+ public void setPortChainReqs(ArrayList<PortChainReq> portChainReqs) {
+ this.portChainReqs = portChainReqs;
+ }
+
+ @SerializedName("port-chain")
+ ArrayList<PortChainReq> 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<String> portPairs;
+
+ public List<String> getPortPairs() {
+ return portPairs;
+ }
+
+ public void setPortPairs(List<String> 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<String> 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<String> getPortPairs() {
+ return portPairs;
+ }
+
+ public void setPortPairs(List<String> 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<PortPairGroupReq> getPortPairGroupReqs() {
+ return portPairGroupReqs;
+ }
+
+ public void setPortPairGroupReqs(ArrayList<PortPairGroupReq> portPairGroupReqs) {
+ this.portPairGroupReqs = portPairGroupReqs;
+ }
+
+ @SerializedName("port-pair-group")
+ ArrayList<PortPairGroupReq> 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<ServiceFunctionParameter> serviceFunctionParameters;
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public ArrayList<ServiceFunctionParameter> getServiceFunctionParameters() {
+ return serviceFunctionParameters;
+ }
+
+ public void setServiceFunctionParameters(ArrayList<ServiceFunctionParameter> 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<PortPairReq> getPortPair() {
+ return portPair;
+ }
+
+ public void setPortPair(ArrayList<PortPairReq> portPair) {
+ this.portPair = portPair;
+ }
+
+ @SerializedName("port-pair")
+ ArrayList<PortPairReq> 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<ServiceFunctionParameter> generateSfParams(Map sfHashParams) {
+ ArrayList<ServiceFunctionParameter> serviceParameters = new ArrayList<ServiceFunctionParameter>();
+ 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<NodeEntity> nodes = new ArrayList<NodeEntity>();
+ 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<ServiceFunctionParameter> serviceFunctionParameters = new ArrayList<ServiceFunctionParameter>();
+ serviceFunctionParameters.addAll(SfcDriverUtil.generateSfParams(portPairReq4N.getSfParam()));
+ portPairReq.setServiceFunctionParameters(serviceFunctionParameters);
+ portPairReq.setUuid(SfcDriverUtil.generateUuid());
+ ArrayList<PortPairReq> portPairList = new ArrayList<PortPairReq>();
+ 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<PortPairGroupReq> portPairGroupReqs = new ArrayList<PortPairGroupReq>();
+ portPairGroupReqs.add(ppg4S);
+ portPairGroupReq4S.setPortPairGroupReqs(portPairGroupReqs);
+
+ return portPairGroupReq4S;
+ }
+
+ public static FlowClassifierReq4S convertFlowClassfier(FlowClassfierReq4N flowClassfierReq4N) {
+ ArrayList<FlowClassfierReq> 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<ChainParameter> chainParam = new ArrayList<ChainParameter>();
+ chainParam.add(SfcDriverUtil.generateChainParam("symmetric", portChainReq4N.isSymmetric() ? "true" : "false"));
+ portChainReq.setChainParams(chainParam);
+ ArrayList<PortChainReq> portChains = new ArrayList<PortChainReq>();
+ portChains.add(portChainReq);
+ PortChainReq4S portChainReq4S = new PortChainReq4S();
+ portChainReq4S.setPortChainReqs(portChains);
+ return portChainReq4S;
+ }
+
+
+}