Physical Connection Creation

Overview

A physical connection is a connection that uses wires, cables, or optical fibers to connect two physical ports in a network.

Here described is an example of OTS physical connection creation.

Physical Connection Creation example (OTS)

In the figure shown below,there are two PSS-32 NEs used which are named as CLOUDE_2 and CLOUDE_3. OTS connection will be created between CLOUDE_2/AHPHG-2-3-LINE to CLOUDE_3/AHPHG-2-3-LINE.

OTS Connection Creation

The input provided to REST client is in json format by means of a json file - CreatePhyConInfo.json. Minimum information required to create connection would be specified in this file. For example A and Z node names, Port Names, Physical connection name and connection type.


CreatePhyConInfo.json content - :
{
    "userLabel" : "REST-CLIENT-OTS",
    "connectionType" : "chooserConnWdm",
    "interWorkingTechnology" : "Technology_wdm", 
    "wdmConnectinoType" : "WdmPortType_ots",

    "allocationCost" : "20",
    "ultraLongSpan" : "Boolean_false",
 
    "aNodeName" : "CLOUD_3",
    "aPortName" : "CLOUD_3/AHPHG-1-6-LINE",
    "zNodeName" : "PSS32_2",
    "zPortName" : "PSS32_2/AHPHG-2-3-LINE" 
}

Creating Request

Converting JSON Input file to JSON Object

Convert input JSON file CreatPhyConnInfo.json into CreatePhyConInfo object.


/** Convert JSON string from input file to CreatePhyConInfo Object **/
CreatePhyConInfo physConnInfo = super.readJSON(new File (jsonFilePath), 
CreatePhyConInfo.class);
 

readJSON() method defined in super class Service uses jackson.databind.ObjectMapper to conver the JSON string into an object.

Retrieve A and Z nodes details using name

Retrieving A and Z node details using nodes name provided as input.


/**Retrieves node details using filter provided in the query string*/
public static JsonNode retreiveNodeDetails (OMSRestTemplate restTemplate, String queryString) {
                
	String retrieveNodeDetailsUrl = restTemplate.getUrlPrefix() + "/data/npr/Node?" + queryString;//select(guiLabel,id,productName,emlNeType)&
	productName!='External%20Network'&guiLabel=" + nodGuiLabel; 
                
	return restTemplate.getForObject(retrieveNodeDetailsUrl, JsonNode.class);
}

method "retreiveNodeDetails" is defined in ServiceUtil class. It uses RestTemplate's getForObject method to make HTTP GET call.

GET REST call used here is /data/npr/Node?queryString

queryString is basically db query passed as a part GET request.


/**Retrieves node details using filter provided in the query string*/
public static JsonNode retreiveNodeDetails (OMSRestTemplate restTemplate, String queryString) {
	String retrieveNodeDetailsUrl = restTemplate.getUrlPrefix() + "/data/npr/Node?" + queryString;//select(guiLabel,id,productName,emlNeType)&
	productName!='External%20Network'&guiLabel=" + nodGuiLabel;
        
   return restTemplate.getForObject(retrieveNodeDetailsUrl, JsonNode.class);
}
Creating JSON Payload to send

Creating JSON final request from the port and node details retrieved from above calls.


/**create JSON request */
String jsonReqString = createJSONPayload (physConnInfo, aNodeDetails, zNodeDetails, aPortDetails, zPortDetails);

In the createJSONPayload method the final JSON request object is created with all the necessary information fetched from input, a and z node/ports objects

Please refer physical connection creation REST API parameters details.


public String createJSONPayload (CreatePhyConInfo physConnInfoList, JsonNode aNodeDetails, JsonNode zNodeDetails, JsonNode aPortDetails, JsonNode zPortDetails) {
     String retStr = "";
     ObjectMapper mapper = new ObjectMapper();
     ObjectNode reqAttributeMap = mapper.createObjectNode();
    //HashMap <String, Object> reqAttributeMap = new HashMap <String, Object> ();
    //objNode.put(fieldName, v)
    reqAttributeMap.put("Tag", "CMD_WIZTYPE_createConn");
    reqAttributeMap.put("userLabel", physConnInfoList.getUserLabel());
    reqAttributeMap.put ("tecnologyDomain", "OTN");
    reqAttributeMap.put("connectionType", physConnInfoList.getConnectionType() );//"chooserConnWdm",
    reqAttributeMap.put("WDMconnectionIwType", physConnInfoList.getInterWorkingTechnology()); // "Technology_wdm",
    reqAttributeMap.put("WDMconnectionType", physConnInfoList.getWdmConnectinoType());// "WdmPortType_ots",
    reqAttributeMap.put("constAllocation", physConnInfoList.getAllocationCost()); //"20"
    reqAttributeMap.put("ultraLongSpan", physConnInfoList.getUltraLongSpan());// "Boolean_false",
    reqAttributeMap.put("aNode" , physConnInfoList.getaNodeName());
    populatereqAttributeMapWithPrefix (aNodeDetails.get(0), "aNode", reqAttributeMap);
    reqAttributeMap.put("zNode" , physConnInfoList.getzNodeName());
    populatereqAttributeMapWithPrefix (zNodeDetails.get(0), "zNode", reqAttributeMap); 
    reqAttributeMap.put("aPort" , physConnInfoList.getaPortName());
    populatereqAttributeMapWithPrefix (aPortDetails.get(0), "aPort", reqAttributeMap);
    reqAttributeMap.put("zPort" , physConnInfoList.getzPortName());
    populatereqAttributeMapWithPrefix (zPortDetails.get(0), "zPort", reqAttributeMap); 
    try {
            retStr = mappe  r.writeValueAsString(reqAttributeMap);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }//createJSONStringFromMap (reqAttributeMap);
   return retStr;
}

Making HTTP Request

Make HTTP POST request to create physical connection. In the createJSONPayload method the final JSON request object is created with all the necessary information fetched from input, a and z node/ports objects

Please refer physical connection creation REST API parameters details.

REST call used: /data/npr/physicalConns


String physConnCreationUrl = restTemplate.getUrlPrefix() + "/data/npr/physicalConns";
HttpEntity<String> entity = new HttpEntity<String>(jsonReqString);
String answer = restTemplate.postForObject(physConnCreationUrl, entity, String.class);

Complete Code

Main class - OmsRestClientApplication.java


public class OmsRestClientApplication {
	public static void main(String[] args) {
	/**Authentication Information like Machine IP, username and password*/
	AuthInfo authInfo = new AuthInfo(); 
	authInfo.setServerIP("135.250.76.157");
	authInfo.setServerPort("8443");
	authInfo.setServerUser("alcatel");
	authInfo.setServerPwd("Lucent1.!");
	authInfo.setPresentationIP("135.250.76.46");

	/**create OMSRestTemplate instance**/
	OMSRestTemplate omsRestTemplate = new OMSRestTemplate ();

	/**authenticate*/
	omsRestTemplate.authenticate(authInfo);

	/**Instantiate physical connection service instance*/
	PysicalConnectionService physConnSvc = new PysicalConnectionService();

	/**invoke creation create*/
	physConnSvc.createPhysicalConnection (omsRestTemplate, "C:\\REST-CLIENT-INPUT\\CreatePhyConInfo.json");
}

Physical connection service class - PysicalConnectionService.java


public class PysicalConnectionService extends Service {
	public void createPhysicalConnection (OMSRestTemplate restTemplate, String jsonFilePath) {
	/** Convert JSON string from input file to CreatePhyConInfo Object **/
	CreatePhyConInfo physConnInfo = super.readJSON(new File (jsonFilePath), CreatePhyConInfo.class);

	/**Retrieve a node detail*/
	String nodeQueryString = "select(guiLabel,id,productName,emlNeType)&productName!='External%20Network'&guiLabel=" + physConnInfo.getaNodeName();
	JsonNode aNodeDetails = ServiceUtil.retreiveNodeDetails(restTemplate, nodeQueryString);
	//List <HashMap <String, String>> aNodeDetailsMap = createHashMapFromJSONString (resp);

	/**Retrieve z node detail*/
	nodeQueryString = "select(guiLabel,id,productName,emlNeType)&productName!='External%20Network'&guiLabel=" + physConnInfo.getzNodeName();
	JsonNode zNodeDetails = ServiceUtil.retreiveNodeDetails(restTemplate, nodeQueryString);
	//List <HashMap <String, String>> zNodeDetailsMap = createHashMapFromJSONString (resp);
	//zNodeDetails.get(0).get(fieldName)

	/**Retrieve a port details*/
	JsonNode aPortDetails = ServiceUtil.retreivePortDetails(restTemplate, physConnInfo.getaPortName(), String.valueOf(aNodeDetails.get(0).get("id")));
	//List <HashMap <String, String>> aPortDetailsMap = createHashMapFromJSONString (resp);

	/**Retrieve a port details*/
	JsonNode zPortDetails = ServiceUtil.retreivePortDetails(restTemplate, physConnInfo.getzPortName(), String.valueOf(zNodeDetails.get(0).get("id")));
	//List <HashMap <String, String>> zPortDetailsMap = createHashMapFromJSONString (resp);

	/**create JSON request */
	String jsonReqString = createJSONPayload (physConnInfo, aNodeDetails, zNodeDetails, aPortDetails, zPortDetails);
	//restTemplate.post
	//URL to create physical connection
	String physConnCreationUrl = restTemplate.getUrlPrefix() + "/data/npr/physicalConns";

	HttpEntity<String> entity = new HttpEntity<String>(jsonReqString);
	String answer = restTemplate.postForObject(physConnCreationUrl, entity, String.class);

	System.out.println("jsonReqString - " + jsonReqString);
	System.out.println("answer - " + answer);
}

 
public String createJSONPayload (CreatePhyConInfo physConnInfoList, JsonNode aNodeDetails, JsonNode zNodeDetails, JsonNode aPortDetails, JsonNode zPortDetails) {
	String retStr = "";
	ObjectMapper mapper = new ObjectMapper();
	ObjectNode reqAttributeMap = mapper.createObjectNode();
	//HashMap <String, Object> reqAttributeMap = new HashMap <String, Object> ();
	//objNode.put(fieldName, v)
	reqAttributeMap.put("Tag", "CMD_WIZTYPE_createConn");
	reqAttributeMap.put("userLabel", physConnInfoList.getUserLabel());
	reqAttributeMap.put ("tecnologyDomain", "OTN");
	reqAttributeMap.put("connectionType", physConnInfoList.getConnectionType() );//"chooserConnWdm",
	reqAttributeMap.put("WDMconnectionIwType", physConnInfoList.getInterWorkingTechnology()); // "Technology_wdm",
	reqAttributeMap.put("WDMconnectionType", physConnInfoList.getWdmConnectinoType());// "WdmPortType_ots",
	reqAttributeMap.put("constAllocation", physConnInfoList.getAllocationCost()); //"20"
	reqAttributeMap.put("ultraLongSpan", physConnInfoList.getUltraLongSpan());// "Boolean_false",
	reqAttributeMap.put("aNode" , physConnInfoList.getaNodeName());
	populatereqAttributeMapWithPrefix (aNodeDetails.get(0), "aNode", reqAttributeMap);
	reqAttributeMap.put("zNode" , physConnInfoList.getzNodeName());
	populatereqAttributeMapWithPrefix (zNodeDetails.get(0), "zNode", reqAttributeMap); 
	reqAttributeMap.put("aPort" , physConnInfoList.getaPortName());
	populatereqAttributeMapWithPrefix (aPortDetails.get(0), "aPort", reqAttributeMap);
	reqAttributeMap.put("zPort" , physConnInfoList.getzPortName());
	populatereqAttributeMapWithPrefix (zPortDetails.get(0), "zPort", reqAttributeMap); 

	try {
		retStr = mapper.writeValueAsString(reqAttributeMap);
	} catch (JsonProcessingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}//createJSONStringFromMap (reqAttributeMap);

	return retStr;
}

 
private void populatereqAttributeMapWithPrefix(JsonNode jsonNode, String prefix, ObjectNode allAttributeMap) {
	Iterator<String> keysIt = jsonNode.fieldNames();
	while (keysIt.hasNext()) {
		String key = keysIt.next();
		allAttributeMap.put(prefix + "_" + key, jsonNode.get(key));
	}
}

Request and Response Data

JSON Request payload


{
    "Tag": "CMD_WIZTYPE_createConn",
    "userLabel": "REST-CLIENT-OTS",
    "tecnologyDomain": "OTN",
    "connectionType": "chooserConnWdm",
    "WDMconnectionIwType": "Technology_wdm",
    "WDMconnectionType": "WdmPortType_ots",
    "constAllocation": "20",
    "ultraLongSpan": "Boolean_false",
    "aNode": "CLOUD_3",
    "aNode_id": 93,
    "aNode_guiLabel": "CLOUD_3",
    "aNode_emlNeType": "1830PSS-PHN",
    "aNode_productName": "1830PSS",
    "zNode": "CLOUD_2",
    "zNode_id": 95,
    "zNode_guiLabel": "CLOUD_2",
    "zNode_emlNeType": "1830PSS-PHN",
    "zNode_productName": "1830PSS",
    "aPort": "CLOUD_3/AHPHG-1-6-LINE",
    "aPort_ObjectId": null,
    "aPort_EventType": null,
    "aPort_ClassType": null,
    "aPort_IdClass": 4,
    "aPort_alarmStatus": "AlarmStatus_cleared",
    "aPort_boardType": "MUX%LINE",
    "aPort_cardType": "AHPHG",
    "aPort_clonePortPresent": "Boolean_false",
    "aPort_compModule": null,
    "aPort_consistSt": "ConsistencyStatus_normal",
    "aPort_currentFrequency": null,
    "aPort_direction": "Direction_bidirectional",
    "aPort_displayLabel": "AHPHG-1-6-LINE",
    "aPort_encoding": "Encoding_notMeaningful",
    "aPort_ethInterfaceRate": "EthInterfaceRate_notMeaningful",
    "aPort_ethInterfaceType": "EthInterType_notApplicable",
    "aPort_fdnMapper": "NC_n=*EML_101_SNA/NE_n=*53/PTPn=*AHPHG-1-6-LINE/:PORT",
    "aPort_fecType": "FecType_notMeaningful",
    "aPort_frequency": "##",
    "aPort_internalEmlAid": "1/6/4",
    "aPort_involvedIn3R": "Boolean_false",
    "aPort_involvedOnInternalCable": "Boolean_false",
    "aPort_involvedOnPhyConn": "Boolean_false",
    "aPort_neId": 91,
    "aPort_neLabel": "CLOUD_3",
    "aPort_networkInterfaceType": "NetworkInterfaceType_notMeaningful",
    "aPort_operationalState": "OperationalState_enabled",
    "aPort_otuSignalType": "OtuSignalType_notMeaningful",
    "aPort_physicalPortType": "PortType_notMeaningful",
    "aPort_portBitRate": null,
    "aPort_id": 1028,
    "aPort_key": "Port/1028",
    "aPort_className": "Port",
    "aPort_technology": "Technology_wdm",
    "aPort_uploadSt": "UploadStatus_normal",
    "aPort_usedDir": "Direction_bidirectional",
    "aPort_usedOnOtn": "Boolean_false",
    "aPort_guiLabel": "CLOUD_3/AHPHG-1-6-LINE",
    "aPort_wdmClientSignalType": "ClientSignalType_notMeaningful",
    "aPort_wdmInterfaceType": "WdmInterfaceType_blackAndWhite",
    "aPort_wdmPhysicalPortRate": null,
    "aPort_wdmPortType": "WdmPortType_ots",
    "aPort_wdmTransmissionMode": "WdmTransMode_notMeaningful",
    "aPort_width": null,
    "zPort": "CLOUD_2/AHPHG-2-3-LINE",
    "zPort_ObjectId": null,
    "zPort_EventType": null,
    "zPort_ClassType": null,
    "zPort_IdClass": 4,
    "zPort_alarmStatus": "AlarmStatus_cleared",
    "zPort_boardType": "MUX%LINE",
    "zPort_cardType": "AHPHG",
    "zPort_clonePortPresent": "Boolean_false",
    "zPort_compModule": null,
    "zPort_consistSt": "ConsistencyStatus_normal",
    "zPort_currentFrequency": null,
    "zPort_direction": "Direction_bidirectional",
    "zPort_displayLabel": "AHPHG-2-3-LINE",
    "zPort_encoding": "Encoding_notMeaningful",
    "zPort_ethInterfaceRate": "EthInterfaceRate_notMeaningful",
    "zPort_ethInterfaceType": "EthInterType_notApplicable",
    "zPort_fdnMapper": "NC_n=*EML_101_SNA/NE_n=*55/PTPn=*AHPHG-2-3-LINE/:PORT",
    "zPort_fecType": "FecType_notMeaningful",
    "zPort_frequency": "##",
    "zPort_internalEmlAid": "2/3/4",
    "zPort_involvedIn3R": "Boolean_false",
    "zPort_involvedOnInternalCable": "Boolean_false",
    "zPort_involvedOnPhyConn": "Boolean_false",
    "zPort_neId": 93,
    "zPort_neLabel": "CLOUD_2",
    "zPort_networkInterfaceType": "NetworkInterfaceType_notMeaningful",
    "zPort_operationalState": "OperationalState_enabled",
    "zPort_otuSignalType": "OtuSignalType_notMeaningful",
    "zPort_physicalPortType": "PortType_notMeaningful",
    "zPort_portBitRate": null,
    "zPort_id": 1055,
    "zPort_key": "Port/1055",
    "zPort_className": "Port",
    "zPort_technology": "Technology_wdm",
    "zPort_uploadSt": "UploadStatus_normal",
    "zPort_usedDir": "Direction_bidirectional",
    "zPort_usedOnOtn": "Boolean_false",
    "zPort_guiLabel": "CLOUD_2/AHPHG-2-3-LINE",
    "zPort_wdmClientSignalType": "ClientSignalType_notMeaningful",
    "zPort_wdmInterfaceType": "WdmInterfaceType_blackAndWhite",
    "zPort_wdmPhysicalPortRate": null,
    "zPort_wdmPortType": "WdmPortType_ots",
    "zPort_wdmTransmissionMode": "WdmTransMode_notMeaningful",
    "zPort_width": null
}

JSON Response


{
	"ok":true,
	"id":"3365987022026218",
	"responseMessage":"ok",
	"responseList":null,
	"HTTPResponse":200,
	"httpresponse":200
}

REST calls used