--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.neutron.spi;
+
+/**
+ * This interface defines the methods for CRUD of NB SFC Port Pair objects
+ *
+ */
+public interface INeutronSFCPortPairCRUD extends INeutronCRUD<NeutronSFCPortPair> {
+ // Nothing Here.
+ // This class is defined to use reflection.
+}
private INeutronL2gatewayCRUD l2gatewayInterface;
private INeutronL2gatewayConnectionCRUD l2gatewayConnectionInterface;
private INeutronSFCFlowClassifierCRUD sfcFlowClassifierInterface;
+ private INeutronSFCPortPairCRUD sfcPortPairInterface;
public NeutronCRUDInterfaces() {
}
return sfcFlowClassifierInterface;
}
+ public INeutronSFCPortPairCRUD getSFCPortPairInterface() {
+ return sfcPortPairInterface;
+ }
+
public NeutronCRUDInterfaces fetchINeutronNetworkCRUD(Object obj) {
networkInterface = (INeutronNetworkCRUD) getInstances(INeutronNetworkCRUD.class, obj);
return this;
return this;
}
+ public NeutronCRUDInterfaces fetchINeutronSFCPortPairCRUD (Object obj) {
+ sfcPortPairInterface =
+ (INeutronSFCPortPairCRUD) getInstances(INeutronSFCPortPairCRUD.class, obj);
+ return this;
+ }
+
public Object getInstances(Class<?> clazz, Object bundle) {
try {
BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass()).getBundleContext();
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.neutron.spi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronSFCPortPair extends NeutronObject implements Serializable, INeutronObject {
+
+ private static final long serialVersionUID = 1L;
+
+ // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
+ // for description of annotated attributes
+ @XmlElement(name = "name")
+ String name;
+
+ @XmlElement(name = "ingress")
+ String ingressPortUUID;
+
+ @XmlElement(name = "egress")
+ String egressPortUUID;
+
+ @XmlElement(name = "service_function_parameters")
+ @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
+ Map<String, String> serviceFunctionParameters;
+
+ public NeutronSFCPortPair() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getIngressPortUUID() {
+ return ingressPortUUID;
+ }
+
+ public void setIngressPortUUID(String ingressPortUUID) {
+ this.ingressPortUUID = ingressPortUUID;
+ }
+
+ public String getEgressPortUUID() {
+ return egressPortUUID;
+ }
+
+ public void setEgressPortUUID(String egressPortUUID) {
+ this.egressPortUUID = egressPortUUID;
+ }
+
+ public Map<String, String> getServiceFunctionParameters() {
+ return serviceFunctionParameters;
+ }
+
+ public void setServiceFunctionParameters(Map<String, String> serviceFunctionParameters) {
+ this.serviceFunctionParameters = serviceFunctionParameters;
+ }
+
+ /**
+ * This method copies selected fields from the object and returns them
+ * as a new object, suitable for marshaling.
+ *
+ * @param fields List of attributes to be extracted
+ * @return an OpenStack Neutron SFC Port Pair object with only the selected fields
+ * populated
+ */
+
+ public NeutronSFCPortPair extractFields(List<String> fields) {
+ NeutronSFCPortPair ans = new NeutronSFCPortPair();
+ Iterator<String> i = fields.iterator();
+ while (i.hasNext()) {
+ String s = i.next();
+ if (s.equals("id")) {
+ ans.setID(this.getID());
+ }
+ if (s.equals("tenant_id")) {
+ ans.setTenantID(this.getTenantID());
+ }
+ if (s.equals("name")) {
+ ans.setName(this.getName());
+ }
+ if (s.equals("ingress")) {
+ ans.setIngressPortUUID(this.getIngressPortUUID());
+ }
+ if (s.equals("egress")) {
+ ans.setEgressPortUUID(this.getEgressPortUUID());
+ }
+ if (s.equals("service_function_parameters")) {
+ ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
+ }
+ }
+ return ans;
+ }
+
+
+ @Override
+ public String toString() {
+ return "NeutronSFCPortPair[" +
+ "tenantID='" + tenantID + '\'' +
+ ", name='" + name + '\'' +
+ ", ingressPortUUID='" + ingressPortUUID + '\'' +
+ ", egressPortUUID='" + egressPortUUID + '\'' +
+ ", serviceFunctionParameters=" + serviceFunctionParameters +
+ ']';
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.neutron.spi;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.xml.bind.JAXBException;
+import java.util.Map;
+
+/**
+ * Created by Anil Vishnoi (avishnoi@Brocade.com)
+ */
+public class NeutronSFCPortPairJAXBTest {
+
+ private static final String NeutronSFCPortPair_sourceJson = "{ "
+ + "\"name\": \"portpair1\", "
+ + "\"ingress\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", "
+ + "\"egress\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", "
+ + "\"service_function_parameters\": [ "
+ + "{ "
+ + "\"correlation\": \"value\" "
+ + "} "
+ + "], "
+ + "\"tenant_id\": \"4969c491a3c74ee4af974e6d800c62de\", "
+ + "\"id\": \"4e8e5957-649f-477b-9e5b-f1f75b21c03c\" }";
+
+ @Test
+ public void test_NeutronSFCPortPair_JAXB() throws JAXBException {
+ NeutronSFCPortPair testObject = new NeutronSFCPortPair();
+ NeutronSFCPortPair neutronObject
+ = (NeutronSFCPortPair) JaxbTestHelper.jaxbUnmarshall(testObject
+ , NeutronSFCPortPair_sourceJson);
+
+ Assert.assertEquals("NeutronSFCPortPair JAXB Test 1: Testing id failed"
+ , "4e8e5957-649f-477b-9e5b-f1f75b21c03c",neutronObject.getID());
+
+ Assert.assertEquals("NeutronSFCPortPair JAXB Test 2: Testing tenant_id failed",
+ "4969c491a3c74ee4af974e6d800c62de", neutronObject.getTenantID());
+
+ Assert.assertEquals("NeutronSFCPortPair JAXB Test 3: Testing ingress failed",
+ "5e8e5957-649f-477b-9e5b-f1f75b21c03c", neutronObject.getIngressPortUUID());
+
+ Assert.assertEquals("NeutronSFCPortPair JAXB Test 4: Testing egress failed",
+ "6e8e5957-649f-477b-9e5b-f1f75b21c03c", neutronObject.getEgressPortUUID());
+
+ Map<String, String> param = neutronObject.getServiceFunctionParameters();
+ Assert.assertEquals("NeutronSFCPortPair JAXB Test 5: Testing service_function_parameters list length " +
+ "failed", 1, param.size());
+ }
+}
classes.add(NeutronL2gatewayNorthbound.class);
classes.add(NeutronL2gatewayConnectionNorthbound.class);
classes.add(NeutronSFCFlowClassifiersNorthbound.class);
+ classes.add(NeutronSFCPortPairsNorthbound.class);
classes.add(MOXyJsonProvider.class);
return classes;
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.neutron.northbound.api;
+
+import org.opendaylight.neutron.spi.NeutronSFCPortPair;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronSFCPortPairRequest implements INeutronRequest<NeutronSFCPortPair> {
+ // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
+ // for description of annotated attributes
+
+ @XmlElement(name="portpair")
+ NeutronSFCPortPair singletonPortPair;
+
+ @XmlElement(name="portpairs")
+ List<NeutronSFCPortPair> bulkRequest;
+
+ NeutronSFCPortPairRequest() {
+ }
+
+ NeutronSFCPortPairRequest(List<NeutronSFCPortPair> bulkRequest) {
+ this.bulkRequest = bulkRequest;
+ this.singletonPortPair = null;
+ }
+
+ NeutronSFCPortPairRequest(NeutronSFCPortPair sfcPortPair) {
+ this.singletonPortPair = sfcPortPair;
+ }
+
+ @Override
+ public NeutronSFCPortPair getSingleton() {
+ return this.singletonPortPair;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return singletonPortPair != null;
+ }
+
+ @Override
+ public List<NeutronSFCPortPair> getBulk() {
+ return this.bulkRequest;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.neutron.northbound.api;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.neutron.spi.INeutronSFCPortPairCRUD;
+import org.opendaylight.neutron.spi.NeutronCRUDInterfaces;
+import org.opendaylight.neutron.spi.NeutronSFCPortPair;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.net.HttpURLConnection;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Neutron Northbound REST APIs for OpenStack SFC Port Pair.<br>
+ * This class provides REST APIs for managing OpenStack SFC Port Pair
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default. Administrator can enable it in
+ * tomcat-server.xml after adding a proper keystore / SSL certificate from a
+ * trusted authority.<br>
+ * More info :
+ * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
+ *
+ */
+
+@Path("/sfc/portpairs")
+public class NeutronSFCPortPairsNorthbound
+ extends AbstractNeutronNorthbound<NeutronSFCPortPair,
+ NeutronSFCPortPairRequest, INeutronSFCPortPairCRUD> {
+
+ private static final String RESOURCE_NAME = "Sfc Port Pair";
+
+ @Override
+ protected String getResourceName() {
+ return RESOURCE_NAME;
+ }
+
+ @Override
+ protected NeutronSFCPortPair extractFields(NeutronSFCPortPair o, List<String> fields) {
+ return o.extractFields(fields);
+ }
+
+ @Override
+ protected NeutronSFCPortPairRequest newNeutronRequest(NeutronSFCPortPair o) {
+ return new NeutronSFCPortPairRequest(o);
+ }
+
+ @Override
+ protected INeutronSFCPortPairCRUD getNeutronCRUD() {
+ NeutronCRUDInterfaces answer = new NeutronCRUDInterfaces().fetchINeutronSFCPortPairCRUD(this);
+ if (answer.getSFCPortPairInterface() == null) {
+ throw new ServiceUnavailableException(serviceUnavailable());
+ }
+ return answer.getSFCPortPairInterface();
+ }
+
+ /**
+ * Returns a list of all SFC Port Pairs*/
+
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON })
+ @StatusCodes({
+ @ResponseCode(code = HttpURLConnection.HTTP_OK, condition = "Operation successful"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAUTHORIZED, condition = "Unauthorized"),
+ @ResponseCode(code = HttpURLConnection.HTTP_NOT_IMPLEMENTED, condition = "Not Implemented"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
+ public Response listSFCPortPairs(
+ // return fields
+ @QueryParam("fields") List<String> fields,
+ @QueryParam("id") String queryID,
+ @QueryParam("name") String queryName,
+ @QueryParam("tenant_id") String queryTenantID,
+ @QueryParam("ingress") String queryIngressPort,
+ @QueryParam("egress") String queryEgressPort
+ ) {
+ INeutronSFCPortPairCRUD sfcPortPairInterface = getNeutronCRUD();
+ List<NeutronSFCPortPair> allSFCPortPair = sfcPortPairInterface.getAll();
+ List<NeutronSFCPortPair> ans = new ArrayList<>();
+ Iterator<NeutronSFCPortPair> i = allSFCPortPair.iterator();
+ while (i.hasNext()) {
+ NeutronSFCPortPair oSFCPP = i.next();
+ if ((queryID == null || queryID.equals(oSFCPP.getID())) &&
+ (queryName == null || queryName.equals(oSFCPP.getName())) &&
+ (queryIngressPort == null || queryIngressPort.equals(oSFCPP.getIngressPortUUID())) &&
+ (queryEgressPort == null || queryEgressPort.equals(oSFCPP.getEgressPortUUID())) &&
+ (queryTenantID == null || queryTenantID.equals(oSFCPP.getTenantID()))) {
+ if (fields.size() > 0) {
+ ans.add(extractFields(oSFCPP,fields));
+ } else {
+ ans.add(oSFCPP);
+ }
+ }
+ }
+
+ return Response.status(HttpURLConnection.HTTP_OK).entity(new NeutronSFCPortPairRequest(ans)).build();
+
+ }
+
+ /**
+ * Returns a specific SFC Port Pair */
+
+ @Path("{portPairUUID}")
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON })
+ @StatusCodes({
+ @ResponseCode(code = HttpURLConnection.HTTP_OK, condition = "Operation successful"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAUTHORIZED, condition = "Unauthorized"),
+ @ResponseCode(code = HttpURLConnection.HTTP_NOT_FOUND, condition = "Not Found"),
+ @ResponseCode(code = HttpURLConnection.HTTP_NOT_IMPLEMENTED, condition = "Not Implemented"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
+ public Response showSFCPortPair(
+ @PathParam("portPairUUID") String sfcPortPairUUID,
+ // return fields
+ @QueryParam("fields") List<String> fields
+ ) {
+ return show(sfcPortPairUUID, fields);
+ }
+
+ /**
+ * Creates new SFC Port Pair*/
+ @POST
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @StatusCodes({
+ @ResponseCode(code = HttpURLConnection.HTTP_CREATED, condition = "Created"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
+ public Response createSFCPortPair(final NeutronSFCPortPairRequest input) {
+ return create(input);
+ }
+
+ @Override
+ protected void updateDelta(String uuid, NeutronSFCPortPair delta, NeutronSFCPortPair original) {
+ /*
+ * note: what we get appears to not be a delta but
+ * rather an incomplete updated object. So we need to set
+ * the ID to complete the object and then send that down
+ * for folks to check
+ */
+
+ delta.setID(uuid);
+ delta.setTenantID(original.getTenantID());
+ }
+
+ /**
+ * Updates an existing SFC Port Pair */
+ @Path("{portPairUUID}")
+ @PUT
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @StatusCodes({
+ @ResponseCode(code = HttpURLConnection.HTTP_OK, condition = "Operation successful"),
+ @ResponseCode(code = HttpURLConnection.HTTP_NOT_FOUND, condition = "Not Found"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
+ public Response updateSFCPortPair(
+ @PathParam("portPairUUID") String sfcPortPairUUID, final NeutronSFCPortPairRequest input
+ ) {
+ return update(sfcPortPairUUID, input);
+ }
+
+ /**
+ * Deletes the SFC Port Pair */
+
+ @Path("{portPairUUID}")
+ @DELETE
+ @StatusCodes({
+ @ResponseCode(code = HttpURLConnection.HTTP_NO_CONTENT, condition = "No Content"),
+ @ResponseCode(code = HttpURLConnection.HTTP_NOT_FOUND, condition = "Not Found"),
+ @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
+ public Response deleteSFCPortPair(
+ @PathParam("portPairUUID") String sfcPortPairUUID) {
+ return delete(sfcPortPairUUID);
+ }
+
+}
{
- "id": "bd69cf69-88f9-1294-33f2-8579727f07a7",
+ "id": "810e37ef-c291-5276-575c-d16b3f7ef595",
"name": "Neutron-Northbound-SFC-Rest-and-Restconf-calls",
"description": "",
"order": [
- "11ff4e31-5708-d346-b8a2-d6cb6e838693",
- "bb773371-1f84-bd3d-3754-9e9d43f68cfc",
- "909e053e-a877-1594-1929-9ccb8f1a517a",
- "2950721e-bc1a-6cde-1322-a4ce974aec55"
+ "1d511ed2-e420-e501-59b3-6107f2878387",
+ "5e12f74c-5edd-dfa7-56e5-4b3c426664c5",
+ "40af0970-df04-8d20-b56b-c0b7a8a23bb4",
+ "b3012570-d38b-432a-2eb6-4a7731450814",
+ "4deeda6e-d087-3833-8349-cc7233f1ca88",
+ "96110c74-ae51-7bb3-e94c-d4c0044ccccc",
+ "8676edc8-697a-aef2-b203-2f840fa648b6",
+ "3d8a5b17-f6f6-c004-5686-5a38ffb3d064"
],
"folders": [],
"timestamp": 1466797738971,
"published": false,
"requests": [
{
- "id": "11ff4e31-5708-d346-b8a2-d6cb6e838693",
+ "id": "1d511ed2-e420-e501-59b3-6107f2878387",
"headers": "Content-Type: application/json\nAccept: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
"url": " http://localhost:8181/controller/nb/v2/neutron/sfc/flowclassifiers/",
"preRequestScript": "",
"time": 1466891330305,
"name": "Create Flow Classifier (non-MDSAL)",
"description": "This REST call create flow classifier using the handcrafted REST API (not through the RESTCONF yang based modles).",
- "collectionId": "bd69cf69-88f9-1294-33f2-8579727f07a7",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
"responses": [],
"rawModeData": "{\n \"flowclassifier\":{\n \"id\": \"444e5957-649f-477b-9e5b-f1f75b21c03c\",\n \"name\": \"fc1\", \n \"ethertype\": \"IPv4\", \n \"protocol\": \"UDP\", \n \"source_port_range_min\": 100, \n \"source_port_range_max\": 200, \n \"destination_port_range_min\": 100, \n \"destination_port_range_max\": 200, \n \"source_ip_prefix\": \"10.0.0.0/24\", \n \"destination_ip_prefix\": \"11.0.0.0/24\", \n \"logical_source_port\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"logical_destination_port\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"l7_parameters\": [\n {\n \"key\":\"value\"\n }\n ],\n \"tenant_id\":\"4969c491a3c74ee4af974e6d800c62de\"\n }\n\n}"
},
{
- "id": "2950721e-bc1a-6cde-1322-a4ce974aec55",
+ "id": "3d8a5b17-f6f6-c004-5686-5a38ffb3d064",
"headers": "Content-Type: application/json\nAccept: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": " http://localhost:8181/controller/nb/v2/neutron/sfc/flowclassifiers/",
+ "url": " http://localhost:8181/controller/nb/v2/neutron/sfc/portpairs/",
"pathVariables": {},
"preRequestScript": "",
"method": "GET",
- "collectionId": "bd69cf69-88f9-1294-33f2-8579727f07a7",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
"data": [],
"dataMode": "raw",
- "name": "All Flow Classifier Data (non-MDSAL)",
- "description": "This REST call fetch all flow classifier data using the handcrafted REST API (not through the RESTCONF yang based modles).",
+ "name": "All Port Pair Data (non-MDSAL)",
+ "description": "This REST call fetch all SFC Port Pair data using the handcrafted REST API (not through the RESTCONF yang based modles).",
"descriptionFormat": "html",
- "time": 1466891619190,
+ "time": 1466977235248,
"version": 2,
"responses": [],
"tests": "",
"rawModeData": "{\n \"flowclassifier\":{\n \"id\": \"444e5957-649f-477b-9e5b-f1f75b21c03c\",\n \"name\": \"fc1\", \n \"ethertype\": \"IPv4\", \n \"protocol\": \"UDP\", \n \"source_port_range_min\": 100, \n \"source_port_range_max\": 200, \n \"destination_port_range_min\": 100, \n \"destination_port_range_max\": 200, \n \"source_ip_prefix\": \"10.0.0.0/24\", \n \"destination_ip_prefix\": \"11.0.0.0/24\", \n \"logical_source_port\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"logical_destination_port\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"l7_parameters\": [\n {\n \"key\":\"value\"\n }\n ],\n \"tenant_id\":\"4969c491a3c74ee4af974e6d800c62de\"\n }\n\n}"
},
{
- "id": "909e053e-a877-1594-1929-9ccb8f1a517a",
+ "id": "40af0970-df04-8d20-b56b-c0b7a8a23bb4",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\nAccept: application/json\n",
"url": "http://localhost:8181/restconf/config/neutron:neutron/sfc-flow-classifiers/sfc-flow-classifier/444e5957-649f-477b-9e5b-f1f75b21c03c",
"pathVariables": {},
"preRequestScript": "",
"method": "GET",
- "collectionId": "bd69cf69-88f9-1294-33f2-8579727f07a7",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
"data": [],
"dataMode": "params",
"name": "Specific FlowClassifier Data from MDSAL",
"helperAttributes": {}
},
{
- "id": "bb773371-1f84-bd3d-3754-9e9d43f68cfc",
+ "id": "4deeda6e-d087-3833-8349-cc7233f1ca88",
+ "headers": "Content-Type: application/json\nAccept: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+ "url": " http://localhost:8181/controller/nb/v2/neutron/sfc/portpairs/",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "POST",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
+ "data": [],
+ "dataMode": "raw",
+ "name": "Create Port Pair (non-MDSAL)",
+ "description": "This REST call create SFC Port Pairr using the handcrafted REST API (not through the RESTCONF yang based modles).",
+ "descriptionFormat": "html",
+ "time": 1466977029811,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "basicAuth",
+ "helperAttributes": {
+ "id": "basic",
+ "username": "admin",
+ "password": "admin",
+ "saveToRequest": true
+ },
+ "rawModeData": "{\n \"portpair\":{\n \"id\": \"444e5957-649f-477b-9e5b-f1f75b21c03c\",\n \"name\": \"fc1\", \n \"ingress\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"egress\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"service_function_parameters\": [\n {\n \"correlation\":\"value\"\n }\n ],\n \"tenant_id\":\"4969c491a3c74ee4af974e6d800c62de\"\n }\n\n}"
+ },
+ {
+ "id": "5e12f74c-5edd-dfa7-56e5-4b3c426664c5",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\nAccept: application/json\n",
"url": "http://localhost:8181/restconf/config/neutron:neutron/sfc-flow-classifiers/",
"preRequestScript": "",
"time": 1466891257026,
"name": "All FlowClassifier Data from MDSAL",
"description": "Fetch SFC Flow Classifier data from the MD-SAL Data Store using the MD-SAL RESTCONF URL. This restconf call can be used to verify that the SFC flow classifier created through handcrafted REST request is indeed present in the MD-SAL Data store. ",
- "collectionId": "bd69cf69-88f9-1294-33f2-8579727f07a7",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
+ "responses": []
+ },
+ {
+ "id": "8676edc8-697a-aef2-b203-2f840fa648b6",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\nAccept: application/json\n",
+ "url": "http://localhost:8181/restconf/config/neutron:neutron/port-pairs/port-pair/444e5957-649f-477b-9e5b-f1f75b21c03c",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1466977199765,
+ "name": "Specific Port Pair Data from MDSAL",
+ "description": "Fetch specific SFC Port Pair data from the MD-SAL Data Store using the MD-SAL RESTCONF URL. This restconf call can be used to verify that the SFC Port Pair created through handcrafted REST request is indeed present in the MD-SAL Data store.",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
"responses": []
+ },
+ {
+ "id": "96110c74-ae51-7bb3-e94c-d4c0044ccccc",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\nAccept: application/json\n",
+ "url": "http://localhost:8181/restconf/config/neutron:neutron/port-pairs/",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "GET",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
+ "data": [],
+ "dataMode": "params",
+ "name": "All PortPairs Data from MDSAL",
+ "description": "Fetch SFC Port Pairs data from the MD-SAL Data Store using the MD-SAL RESTCONF URL. This restconf call can be used to verify that the SFC Port Pairs created through handcrafted REST request is indeed present in the MD-SAL Data store. ",
+ "descriptionFormat": "html",
+ "time": 1466977114266,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {}
+ },
+ {
+ "id": "b3012570-d38b-432a-2eb6-4a7731450814",
+ "headers": "Content-Type: application/json\nAccept: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
+ "url": " http://localhost:8181/controller/nb/v2/neutron/sfc/flowclassifiers/",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "GET",
+ "collectionId": "810e37ef-c291-5276-575c-d16b3f7ef595",
+ "data": [],
+ "dataMode": "raw",
+ "name": "All Flow Classifier Data (non-MDSAL)",
+ "description": "This REST call fetch all flow classifier data using the handcrafted REST API (not through the RESTCONF yang based modles).",
+ "descriptionFormat": "html",
+ "time": 1466891619190,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "basicAuth",
+ "helperAttributes": {
+ "id": "basic",
+ "username": "admin",
+ "password": "admin",
+ "saveToRequest": true
+ },
+ "rawModeData": "{\n \"flowclassifier\":{\n \"id\": \"444e5957-649f-477b-9e5b-f1f75b21c03c\",\n \"name\": \"fc1\", \n \"ethertype\": \"IPv4\", \n \"protocol\": \"UDP\", \n \"source_port_range_min\": 100, \n \"source_port_range_max\": 200, \n \"destination_port_range_min\": 100, \n \"destination_port_range_max\": 200, \n \"source_ip_prefix\": \"10.0.0.0/24\", \n \"destination_ip_prefix\": \"11.0.0.0/24\", \n \"logical_source_port\": \"5e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"logical_destination_port\": \"6e8e5957-649f-477b-9e5b-f1f75b21c03c\", \n \"l7_parameters\": [\n {\n \"key\":\"value\"\n }\n ],\n \"tenant_id\":\"4969c491a3c74ee4af974e6d800c62de\"\n }\n\n}"
}
]
}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.neutron.transcriber;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.neutron.spi.INeutronSFCPortPairCRUD;
+import org.opendaylight.neutron.spi.NeutronSFCPortPair;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.pair.attributes.ServiceFunctionParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.pair.attributes.ServiceFunctionParametersBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.port.pair.attributes.ServiceFunctionParametersKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.PortPairs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pairs.PortPair;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.sfc.rev160511.sfc.attributes.port.pairs.PortPairBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Created by Anil Vishnoi (avishnoi@Brocade.com)
+ */
+public class NeutronSFCPortPairInterface
+ extends AbstractNeutronInterface<PortPair, PortPairs, NeutronSFCPortPair>
+ implements INeutronSFCPortPairCRUD {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortPairInterface.class);
+
+ NeutronSFCPortPairInterface(DataBroker db) {
+ super(db);
+ }
+
+ @Override
+ protected InstanceIdentifier<PortPair> createInstanceIdentifier(PortPair portPair) {
+ return InstanceIdentifier.create(Neutron.class).child(PortPairs.class)
+ .child(PortPair.class, portPair.getKey());
+ }
+
+ @Override
+ protected InstanceIdentifier<PortPairs> createInstanceIdentifier() {
+ return InstanceIdentifier.create(Neutron.class).child(PortPairs.class);
+ }
+
+ @Override
+ protected PortPair toMd(NeutronSFCPortPair neutronPortPair) {
+
+ LOGGER.trace("toMd: REST SFC Port Pair data : {}", neutronPortPair);
+
+ PortPairBuilder result = new PortPairBuilder();
+ result.setUuid(new Uuid(neutronPortPair.getID()));
+ result.setName(neutronPortPair.getName());
+ result.setTenantId(toUuid(neutronPortPair.getTenantID()));
+ if (neutronPortPair.getIngressPortUUID() != null ) {
+ result.setIngress(new Uuid(neutronPortPair.getIngressPortUUID()));
+ }
+ if (neutronPortPair.getEgressPortUUID() != null) {
+ result.setEgress(new Uuid(neutronPortPair.getEgressPortUUID()));
+ }
+ if (neutronPortPair.getServiceFunctionParameters()!= null) {
+ List<ServiceFunctionParameters> serviceFunctionParams = new ArrayList<>();
+ for(String paramKey : neutronPortPair.getServiceFunctionParameters().keySet()) {
+ ServiceFunctionParametersBuilder param = new ServiceFunctionParametersBuilder();
+ param.setKey(new ServiceFunctionParametersKey(paramKey));
+ param.setServiceFunctionParameter(paramKey);
+ param.setServiceFunctionParameterValue(neutronPortPair.getServiceFunctionParameters().get(paramKey));
+ serviceFunctionParams.add(param.build());
+ }
+ result.setServiceFunctionParameters(serviceFunctionParams);
+ }
+ LOGGER.trace("toMd: Yang SFC Port Pair data : {}", result);
+ return result.build();
+ }
+
+ @Override
+ protected PortPair toMd(String uuid) {
+ final PortPairBuilder portPairBuilder = new PortPairBuilder();
+ portPairBuilder.setUuid(toUuid(uuid));
+ return portPairBuilder.build();
+ }
+
+ @Override
+ protected NeutronSFCPortPair fromMd(PortPair mdPortPair) {
+ LOGGER.trace("fromMd: Yang SFC Port Pair data : {}", mdPortPair);
+ NeutronSFCPortPair result = new NeutronSFCPortPair();
+ result.setID(mdPortPair.getUuid().getValue());
+ result.setName(mdPortPair.getName());
+ result.setTenantID(mdPortPair.getTenantId());
+ if (mdPortPair.getIngress() !=null) {
+ result.setIngressPortUUID(mdPortPair.getIngress().getValue());
+ }
+ if (mdPortPair.getEgress() != null) {
+ result.setEgressPortUUID(mdPortPair.getEgress().getValue());
+ }
+ if (mdPortPair.getServiceFunctionParameters()!= null) {
+ HashMap<String, String> serviceFunctionParam = new HashMap<>();
+ for(ServiceFunctionParameters param : mdPortPair.getServiceFunctionParameters()) {
+ serviceFunctionParam.put(param.getServiceFunctionParameter(),param.getServiceFunctionParameterValue());
+ }
+ result.setServiceFunctionParameters(serviceFunctionParam);
+ }
+ LOGGER.trace("fromMd: REST SFC Port Pair data : {}", result);
+ return result;
+ }
+
+ @Override
+ protected List<PortPair> getDataObjectList(PortPairs dataObjects) {
+ return dataObjects.getPortPair();
+ }
+
+}
import org.opendaylight.neutron.spi.INeutronPortCRUD;
import org.opendaylight.neutron.spi.INeutronRouterCRUD;
import org.opendaylight.neutron.spi.INeutronSFCFlowClassifierCRUD;
+import org.opendaylight.neutron.spi.INeutronSFCPortPairCRUD;
import org.opendaylight.neutron.spi.INeutronSecurityGroupCRUD;
import org.opendaylight.neutron.spi.INeutronSecurityRuleCRUD;
import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
private NeutronVPNIPSECSiteConnectionsInterface vPNIPSECSiteConnectionsInterface;
private NeutronVPNServiceInterface vPNServiceInterface;
private NeutronSFCFlowClassifierInterface sfcFlowClassifierInterface;
+ private NeutronSFCPortPairInterface sfcPortPairInterface;
public NeutronTranscriberProvider(BundleContext context, DataBroker db) {
LOGGER.debug("DataBroker set to: {}", db);
sfcFlowClassifierInterface = new NeutronSFCFlowClassifierInterface(db);
registerCRUDInterface(INeutronSFCFlowClassifierCRUD.class,sfcFlowClassifierInterface);
+ sfcPortPairInterface = new NeutronSFCPortPairInterface(db);
+ registerCRUDInterface(INeutronSFCPortPairCRUD.class, sfcPortPairInterface);
+
// We don't need context any more
this.context = null;
}