Network Protection Architecture (NPA) Examples

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 examples of NPA operations

Create Network Protection Architecture (NPA)

Network Protection Architecture (NPA) is OMS concept to group controle plane entities.

NPA has different states -

  • Defined
  • Implemented
  • failedToImplement (in case of failure)
  • failedDeImplement (in case of failure).

REST API to create NPA is POST /data/npr/npas

Below is code snippet to create NPA. createNPA method takes, NPA name and comments details as input.


/***
*
* This API creates new NPA in defined state.
*
* {"Tag":"createNpa","userLabel":"NPA-L0CP-1","comment1":"","comment2":""}
*
* */
public JsonNode createNPA (OMSRestTemplate restTemplate, String userLabel, String comment1, String comment2) {
	/**REST URL to create NPA*/
	String npaCrUrl = restTemplate.getUrlPrefix() + "/data/npr/npas/";

	/**create JSON request Object*/
	ObjectNode req = mapper.createObjectNode();
	req.put("Tag", "createNpa"); //operation name
	req.put("userLabel", userLabel);
	req.put("comment1", comment1);
	req.put("comment2", comment2);

	/**make POST request to create NPA*/
	return restTemplate.postForObject(npaCrUrl, req, JsonNode.class); 
}

JSON Request


{
	"Tag":"createNpa",
	"userLabel":"NPA-CP0-3",
	"comment1":"","comment2":""
}

JSON Response


{
	"ok": true,
	"id": "73223950379893",
	"responseMessage": "NPA Creation Validation is successful",
	"responseList": [
		{
			"requestType": "Info",
			"messagetag": "TDMmsg_95_73",
			"errorMsgData": [
				null
			],
			"requestStatus": "Success"
		}
	],
	"HTTPResponse": 200,
	"asonResponseList": [
		{
			"requestType": "Info",
			"messagetag": "TDMmsg_95_73",
			"errorMsgData": [
				null
			],
			"requestStatus": "Success"
		}
	],
	"requestStatus": "Success",
	"eventableObjects": {
	},
	"httpresponse": 200
}

Delete Network Protection Architecture (NPA)

Deletes NPA from OMS.

REST API to delete NPA is DELETE /data/npr/npas/{npaId}.

This deletes NPA in Defined state.

Code snippet to delete NPA. deleteNPA method takes NPA name as input, and retrieves NPA details, and makes REST call to delete NPA.

Before deleting NPA, all the links should be un-assigned from NPA.


/**
*
* Deletes NPA from OMS.
*
*
* */
public JsonNode deleteNPA (OMSRestTemplate restTemplate, String userLabel) {
	/**get details of NPA...id is required for deletion*/
	JsonNode n = getNPADetails(restTemplate, userLabel);
	System.out.println("node " + n);;
	if (n == null) return null;

	/**Delete REST URL*/
	String npaDelUrl = restTemplate.getUrlPrefix() + "/data/npr/npas/" + n.get("id").asText(); 

	/**Make HTTP DELETE REST call*/
	ResponseEntity <JsonNode> response = restTemplate.exchange (npaDelUrl, HttpMethod.DELETE, null, JsonNode.class);

	return response != null ? response.getBody() : null; 
}

JSON Request


/oms1350/data/npr/npas/151

JSON Response


{
  "ok": true,
  "id": "113611301585197",
  "responseMessage": "Delete NPA Validation is successful",
  "responseList": [
    {
      "requestType": "Info",
      "messagetag": "TDMmsg_95_73",
      "errorMsgData": [
        null
      ],
      "requestStatus": "Success"
    }
  ],
  "HTTPResponse": 200,
  "asonResponseList": [
    {
      "requestType": "Info",
      "messagetag": "TDMmsg_95_73",
      "errorMsgData": [
        null
      ],
      "requestStatus": "Success"
    }
  ],
  "requestStatus": "Success",
  "eventableObjects": {
  },
  "httpresponse": 200
}

Implement Network Protection Architecture (NPA)

Moves state of NPA from Defined State/failedToImp to Implemented state.

REST API to Implement NPA is PUT /data/npr/npas/{npaId}.

This deletes NPA in Defined state.

Code snippet to Implement NPA. ImplNPA method takes NPA name as input, retrieves NPA details, and makes PUT REST call to implement NPA.


/***
*
* This method moves NPA from Defined/failedToImplement state to Implemented.
* {"Tag":"F_POP_Impl","userLabel":"NPA-L0CP-1"}
*
* */
public JsonNode ImplNPA (OMSRestTemplate restTemplate, String userLabel) {
	/**retrieve NPA details..as NAP id is required for implementing NPA*/
	JsonNode n = getNPADetails(restTemplate, userLabel);
	if (n == null) return null;
		/**REST URL to implement NPA*/
		String npaCrUrl = restTemplate.getUrlPrefix() + "/data/npr/npas/" + n.get("id").asText(); 

		/**build JSON Request object*/
		ObjectNode req = mapper.createObjectNode();
		req.put("Tag", "F_POP_Impl"); //operation name
		req.put("userLabel", userLabel);

		/**make REST call to implement NPA*/

		return restTemplate.postForObject(npaCrUrl, req, JsonNode.class);//(npaCrUrl, JsonNode.class); 
}

JSON Request


{
	"Tag":"F_POP_Impl",
	"userLabel":"NPA-CP0-3"
}

JSON Response


{
  "ok": true,
  "id": "113975649714798",
  "responseMessage": "ok",
  "responseList": [
    {
      "requestType": "Info",
      "messagetag": "TDMmsg_95_73",
      "errorMsgData": [
        null
      ],
      "requestStatus": "Success"
    }
  ],
  "HTTPResponse": 200,
  "asonResponseList": [
    {
      "requestType": "Info",
      "messagetag": "TDMmsg_95_73",
      "errorMsgData": [
        null
      ],
      "requestStatus": "Success"
    }
  ],
  "requestStatus": "Success",
  "eventableObjects": {
    "/oms1350/events/npr/Npa": [
      {
        "targetObj": {
          "myclass": "Npa",
          "id": "152"
        },
        "attributes": {
          "IdClass": 34,
          "alarmStatus": "AlarmStatus_cleared",
          "asapName": "default ASAP",
          "bundlingRule": "BundlingRule_withSameRisks",
          "confSt": "ConfigurationState_implemented",
          "modeOfOperation": "ProtOperationMode_revertive",
          "id": 152,
          "key": "Npa/152",
          "className": "Npa",
          "npaReductionCostFactor": 20,
          "npaType": "NpaType_ason",
          "npaUsageCost": 20,
          "npaWrkSt": "NpaWorkingState_normal",
          "operationalState": "OperationalState_disabled",
          "operatorCommand": "OperatorCommand_notMeaningful",
          "plusAPSMode": "PlusAPSMode_genericAPS",
          "protSwitchMode": "ProtSwitchMode_bidirectional",
          "protectionStatus": "ProtStatus_notMeaningful",
          "supportedAu3": "SupportedAu3_notMeaningful",
          "switchUponSD": "Boolean_true",
          "timeSlotInterchange": "TimeSlotInterchange_allowed",
          "trafficPosition": "TrafficPosition_notMeaningful",
          "transpTechnology": "ConnecTechnology_wdm",
          "guiLabel": "NPA-CP0-3"
        },
        "type": "Modify"
      }
    ]
  },
  "httpresponse": 200
}

DeImplement Network Protection Architecture (NPA)

Moves state of NPA from Implemented/failedToImplement State to Defined state.

REST API to DeImplement NPA is PUT /data/npr/npas/{npaId}.

This deletes NPA in Defined state.

Code snippet to DeImplement NPA. DeImplNPA method takes NPA name as input, retrieves NPA details, and makes PUT REST call to deImplement NPA.


/***
*
* This method deimplements NPA. Moves state of NPA from Implemented/failedToImplement to Defined state.
* {"Tag":"F_POP_Deimpl","userLabel":"NOKIA-NPA"}
*
* */
public JsonNode DeImplNPA (OMSRestTemplate restTemplate, String userLabel) {
	/**retrieve NPA details..as NAP id is required for deimplementing NPA*/
	JsonNode n = getNPADetails(restTemplate, userLabel);
	System.out.println("node " + n);;
	if (n == null) return null;

	/**REST URL to deimplement NPA*/
	String npaCrUrl = restTemplate.getUrlPrefix() + "/data/npr/npas/" + n.get("id").asText(); 

	/**build input JSON request*/
	ObjectNode req = mapper.createObjectNode();
	req.put("Tag", "F_POP_Deimpl"); //operation name
	req.put("userLabel", userLabel);

	/**make HTTP POST call to move NPA to Defined state*/
	return restTemplate.postForObject(npaCrUrl, req, JsonNode.class);//(npaCrUrl, JsonNode.class); 
}

JSON Request


{
	"Tag":"F_POP_Deimpl",
	"userLabel":"NPA-CP0-3"
}

JSON Response


{
  "ok": true,
  "id": "114153618966432",
  "responseMessage": "ok",
  "responseList": [
    {
      "requestType": "Info",
      "messagetag": "TDMmsg_95_73",
      "errorMsgData": [
        null
      ],
      "requestStatus": "Success"
    }
  ],
  "HTTPResponse": 200,
  "asonResponseList": [
    {
      "requestType": "Info",
      "messagetag": "TDMmsg_95_73",
      "errorMsgData": [
        null
      ],
      "requestStatus": "Success"
    }
  ],
  "requestStatus": "Success",
  "eventableObjects": {
    "/oms1350/events/npr/Npa": [
      {
        "targetObj": {
          "myclass": "Npa",
          "id": "152"
        },
        "attributes": {
          "IdClass": 34,
          "alarmStatus": "AlarmStatus_cleared",
          "asapName": "default ASAP",
          "bundlingRule": "BundlingRule_withSameRisks",
          "confSt": "ConfigurationState_defined",
          "modeOfOperation": "ProtOperationMode_revertive",
          "id": 152,
          "key": "Npa/152",
          "className": "Npa",
          "npaReductionCostFactor": 20,
          "npaType": "NpaType_ason",
          "npaUsageCost": 20,
          "npaWrkSt": "NpaWorkingState_normal",
          "operationalState": "OperationalState_disabled",
          "operatorCommand": "OperatorCommand_notMeaningful",
          "plusAPSMode": "PlusAPSMode_genericAPS",
          "protSwitchMode": "ProtSwitchMode_bidirectional",
          "protectionStatus": "ProtStatus_notMeaningful",
          "supportedAu3": "SupportedAu3_notMeaningful",
          "switchUponSD": "Boolean_true",
          "timeSlotInterchange": "TimeSlotInterchange_allowed",
          "trafficPosition": "TrafficPosition_notMeaningful",
          "transpTechnology": "ConnecTechnology_wdm",
          "guiLabel": "NPA-CP0-3"
        },
        "type": "Modify"
      }
    ]
  },
  "httpresponse": 200
}

Lock ASON Link (Admin state change)

Locks ASON Link.

Code snippet to Lock ASON link.


/**
* Locks ASON Link
*
* */
public JsonNode lockASONLink (OMSRestTemplate restTemplate, String asonLinkName) {
	JsonNode response = null;

	/**get ASON link details...*/
	JsonNode linkDetails = getAsonLinkDetails (restTemplate, asonLinkName);
	if ( linkDetails != null && linkDetails.size() > 0 ) {
		/**fetch ID of ASON link from the detail object*/
		String linkId = linkDetails.get(0).get("id").asText();

		/**URL to lock ason*/
		String lockNPAUrl = restTemplate.getUrlPrefix() + "/data/npr/linkAsons/" + linkId;

		/**create Json request object*/
		ObjectNode req = mapper.createObjectNode();
		req.put("Tag", "LockedLink"); //operation name
		req.put("userLabel", asonLinkName);

		System.out.println(" ason link" + req);

		/**make post request*/
		response = restTemplate.postForObject(lockNPAUrl, req, JsonNode.class);
	}
	System.out.println("response - " + response);

	return response;
}

JSON Request


{
	"Tag":"LockedLink",
	"userLabel":"L0CP-NODE-A/AHPHG-3-15-LINE-L0CP-NODE-F/AHPHG-2-8-LINE/1"
}

JSON Response


{
	"ok": true,
	"id": "859224448287941",
	"responseMessage": "Changing administrative state of AsonLink is successful",
	"responseList": [
	],
	"HTTPResponse": 200,
	"asonResponseList": [
	],
	"requestStatus": "Success",
	"eventableObjects": {
	},
	"httpresponse": 200
}

Un Lock ASON Link (Admin state change)

Un Locks ASON Link.

Code snippet to un Lock ASON link.


/**
* unLock ASON link
* */
public JsonNode unLockASONLink (OMSRestTemplate restTemplate, String asonLinkName) {
	JsonNode response = null;

	/**get Son link details*/
	JsonNode linkDetails = getAsonLinkDetails (restTemplate, asonLinkName);
	if ( linkDetails != null ) {
		/**extract linkid*/
		String linkId = linkDetails.get("id").asText();

		/**unlock REST URL*/
		String lockNPAUrl = restTemplate.getUrlPrefix() + "/data/npr/linkAsons/" + linkId;

		/**create Json request object*/
		ObjectNode req = mapper.createObjectNode();
		req.put("Tag", "UnlockLink"); //operation name
		req.put("userLabel", asonLinkName);

		/**make HTTP Request*/
		response = restTemplate.postForObject(lockNPAUrl, req, JsonNode.class);
	}
	System.out.println("response - " + response);

	return response;
}

JSON Request


{
	"Tag":"UnlockLink",
	"userLabel":"L0CP-NODE-A/AHPHG-3-8-LINE-L0CP-NODE-E/AHPHG-2-8-LINE/1"
}

JSON Response


{
	"ok": true,
	"id": "859224448287941",
	"responseMessage": "Changing administrative state of AsonLink is successful",
	"responseList": [
	],
	"HTTPResponse": 200,
	"asonResponseList": [
	],
	"requestStatus": "Success",
	"eventableObjects": {
	},
	"httpresponse": 200
}

Assign links to ASON (NPA)

Assign Link to ASON.

Code snippet to assing link to ASON.


/***
*
* assign passed Links to ASON NPA.
*
* example request
*
*
{
	"Tag": "addLinksInNpa",
	"id": "91",
	"confSt": "ConfigurationState_implemented",
	"guiLabel": "L0CP-NPA",
	"latency": "",
	"allPathCost": "",
	"asonWTR": "",
	"colorProfileName": "",
	"inniLinks_length": 2,
	"inniLinks_0_IdClass": 16,
	"inniLinks_0_alarmStatus": "AlarmStatus_cleared",
	"inniLinks_0_allPathCost": 20,
	"inniLinks_0_category": "OMSlink",
	"inniLinks_0_id": 1609,
	"inniLinks_0_key": "AsonPotentialLink/1609",
	"inniLinks_0_className": "AsonPotentialLink",
	"inniLinks_0_latency": 0,
	"inniLinks_0_linkType": "LinkType_i_nni",
	"inniLinks_0_operationalState": "OperationalState_enabled",
	"inniLinks_0_srgPresent": "ObjectPresent_notPresent",
	"inniLinks_0_guiLabel": "L0CP-NODE-A/AHPHG-3-8-LINE-L0CP-NODE-E/AHPHG-2-8-LINE/1",
	"inniLinks_1_IdClass": 16,
	"inniLinks_1_alarmStatus": "AlarmStatus_cleared",
	"inniLinks_1_allPathCost": 20,
	"inniLinks_1_category": "OMSlink",
	"inniLinks_1_id": 1610,
	"inniLinks_1_key": "AsonPotentialLink/1610",
	"inniLinks_1_className": "AsonPotentialLink",
	"inniLinks_1_latency": 0,
	"inniLinks_1_linkType": "LinkType_i_nni",
	"inniLinks_1_operationalState": "OperationalState_enabled",
	"inniLinks_1_srgPresent": "ObjectPresent_notPresent",
	"inniLinks_1_guiLabel": "L0CP-NODE-A/AHPHG-3-15-LINE-L0CP-NODE-F/AHPHG-2-8-LINE/1"
}
*
* */

public JsonNode assignLinksToAson (OMSRestTemplate restTemplate, String napName, List <String> linksName ) {
	JsonNode response = null;

	/*Retrieve NPA details by Name**/
	JsonNode npa = this.getNPADetails(restTemplate, napName);
	System.out.println("npa" + npa);
	ObjectNode request = mapper.createObjectNode();

	/**add operation name*/
	request.put("Tag", "addLinksInNpa"); ///operation Name

	/**if NPA exists, retrieve link details and assign to NPA*/
	if ( npa != null && npa.get("id").asText() != null ) {
		/**populate NPA details in the request object*/
		request.put("id", npa.get("id").asText()); ///add NPA Id
		request.put("confSt",npa.get("confSt").asText()); //add confSt of NPA
		request.put("guiLabel", npa.get("guiLabel").asText()); //add NPA name.

		/**need to check the default values*/
		request.put("latency", "");
		request.put( "allPathCost","");
		request.put("asonWTR", "");
		request.put("colorProfileName", "");

		/**Retrieve potential ASON Links detail*/
		List <JsonNode> linksDetail = this.getPotentialAsonLinksDetail(restTemplate, linksName);
		request.put("inniLinks_length", linksDetail.size());
		int numberOfLinks = 0;
		Iterator <JsonNode> linksDetailIt = linksDetail.iterator();

		/**assuming that we got link details for all the input link names...if not we may need to throw exception..improve this later*/
		while ( linksDetailIt.hasNext() ) {
			JsonNode linkD = linksDetailIt.next();
			Iterator <String> fieldNames = linkD.fieldNames();

			/**iterate over fields name and put it in request with prefix "inniLinks_{numberOfLinks}_fieldName"*/
			while (fieldNames.hasNext()) {
				String fieldName = fieldNames.next(); 
				if (fieldName.equals("IdClass") || fieldName.equals("allPathCost") || fieldName.equals("id") || fieldName.equals("latency")) {
					request.put("inniLinks_" + numberOfLinks + "_" + fieldName, linkD.get(fieldName).asLong());
				} else {
					request.put("inniLinks_" + numberOfLinks + "_" + fieldName, linkD.get(fieldName).asText());
				}
			}
			numberOfLinks++;
		}

		/**send POST request to assign links to ASON */
		if ( linksDetail.size() > 0 ) {
			String assingLinksToAsonUrl = restTemplate.getUrlPrefix() + "/data/npr/npas/" + npa.get("id").asText();
			System.out.println("assingLinksToAsonUrl" + assingLinksToAsonUrl);
			System.out.println("request Object" + request);

			response = restTemplate.postForObject(assingLinksToAsonUrl, request, JsonNode.class);
		}
	}
	System.out.println( "Response - " + response );

	return response; 
}

JSON Request


{
	"Tag": "addLinksInNpa",
	"id": "91",
	"confSt": "ConfigurationState_implemented",
	"guiLabel": "L0CP-NPA",
	"latency": "",
	"allPathCost": "",
	"asonWTR": "",
	"colorProfileName": "",
	"inniLinks_length": 1,
	"inniLinks_0_IdClass": 16,
	"inniLinks_0_alarmStatus": "AlarmStatus_cleared",
	"inniLinks_0_allPathCost": 20,
	"inniLinks_0_category": "OMSlink",
	"inniLinks_0_id": 1609,
	"inniLinks_0_key": "AsonPotentialLink/1609",
	"inniLinks_0_className": "AsonPotentialLink",
	"inniLinks_0_latency": 0,
	"inniLinks_0_linkType": "LinkType_i_nni",
	"inniLinks_0_operationalState": "OperationalState_enabled",
	"inniLinks_0_srgPresent": "ObjectPresent_notPresent",
	"inniLinks_0_guiLabel": "L0CP-NODE-A/AHPHG-3-8-LINE-L0CP-NODE-E/AHPHG-2-8-LINE/1"
}

JSON Response


{
	"ok": true,
	"id": "859224448287941",
	"responseMessage": "Changing administrative state of AsonLink is successful",
	"responseList": [
	],
	"HTTPResponse": 200,
	"asonResponseList": [
	],
	"requestStatus": "Success",
	"eventableObjects": {
	},
	"httpresponse": 200
}

Un Assign links from ASON (NPA)

Un Assign Link from ASON.

Code snippet to un assign link from ASON.


public JsonNode removeLinkFromAson ( OMSRestTemplate restTemplate, String asonLinkName ) {
	ResponseEntity<JsonNode> response = null;
	JsonNode linkDetails = getAsonLinkDetails (restTemplate, asonLinkName);
	if ( linkDetails != null ) {
		String npaId = linkDetails.get("npaId").asText();
		String linkId = linkDetails.get("id").asText();
		String removeLinkFromAsonUrl = restTemplate.getUrlPrefix() + "/data/npr/npas/" + npaId + "/linkAsons/" + linkId;
		//restTemplate.delete(removeLinkFromAsonUrl);
		response = restTemplate.exchange (removeLinkFromAsonUrl, HttpMethod.DELETE, null, JsonNode.class);

		System.out.println("response" + response.getBody());
	}

	return response != null? response.getBody():null;
}

JSON Request


{
	"Tag": "addLinksInNpa",
	"id": "91",
	"confSt": "ConfigurationState_implemented",
	"guiLabel": "L0CP-NPA",
	"latency": "",
	"allPathCost": "",
	"asonWTR": "",
	"colorProfileName": "",
	"inniLinks_length": 1,
	"inniLinks_0_IdClass": 16,
	"inniLinks_0_alarmStatus": "AlarmStatus_cleared",
	"inniLinks_0_allPathCost": 20,
	"inniLinks_0_category": "OMSlink",
	"inniLinks_0_id": 1609,
	"inniLinks_0_key": "AsonPotentialLink/1609",
	"inniLinks_0_className": "AsonPotentialLink",
	"inniLinks_0_latency": 0,
	"inniLinks_0_linkType": "LinkType_i_nni",
	"inniLinks_0_operationalState": "OperationalState_enabled",
	"inniLinks_0_srgPresent": "ObjectPresent_notPresent",
	"inniLinks_0_guiLabel": "L0CP-NODE-A/AHPHG-3-8-LINE-L0CP-NODE-E/AHPHG-2-8-LINE/1"
}

JSON Response


{
	"ok": true,
	"id": "859224448287941",
	"responseMessage": "Changing administrative state of AsonLink is successful",
	"responseList": [
	],
	"HTTPResponse": 200,
	"asonResponseList": [
	],
	"requestStatus": "Success",
	"eventableObjects": {
	},
	"httpresponse": 200
}