An ethernet service can be protected (over a ethernet ring path) or unprotected.
Here described is an example of service created over a ring path (protected)
In the example shown in below figure an EPL service is created with a simple configuration. The service is created over a protection path. The Ethernet Ring Path here is named as “ERP-1-REST”( a three node ring). There are four packs involved. Each pack is represented in format <Pack_Name>-<Shelf>-<Slot> . NODE-O(11QCE12X-1-10) , NODE-O(11QCE12X-1-11), NODE-K(11QCE12X-2-7) and NODE-N (11QPE24-1-10). The end points are represented in format <Pack_Name>-<Shelf>-<Slot>-<Port_Name> (port name is representation of end point at the Network element). Here we have end points on NODE-K(11QCE12X-2-7-C9) and NODE-N(11QPE24-1-10-C10). This is represented in image below.
The input is provided in json format by means of a json file in format of the input object
For the example shown above we provide input as :
{
"serviceName" : "TEST_SERVICE_REST_TC",
"serviceDescription" : "REST-CLIENT",
"customerName" : "REST-CLIENT",
"author" : "TC",
"serviceType" : "EPL",
"serviceTemplateFullPath":"My Templates/Service Templates/SERVICE-TEMPLATE-REST_CLIENT",
"ringNames" : [
"ERP-1-REST"
],
"linkNames" : [
],
"ringHubNode" : "",
"cvlanRangeValue" : "",
"reserveResource" : "1",
"shgName" : "",
"shgDescription" : "",
"oamConfigured" : true,
"preCliText" : "",
"postCliText" : "",
"uniPortInfo" : [
{
"nodeName" : "REST-K",
"tpNativeName" : "11QCE12X-2-7-C9",
"mclagConfigName" : "",
"accessSVLAN" : "",
"accessCVLAN" : "",
"endPointRole" : "",
"frameType" : ""
},
{
"nodeName" : "REST-N",
"tpNativeName" : "11QPE24-1-10-C10",
"mclagConfigName" : "",
"accessSVLAN" : "",
"accessCVLAN" : "",
"endPointRole" : "",
"frameType" : ""
}
]
};
Now to generate the input request from the above information provided.
N_ServiceInstHolderMapper serviceInput = new N_ServiceInstHolderMapper();
nRequestHeaderMapper nReqHeader = new nRequestHeaderMapper();
/** Generate request header **/
generateReqHeader(nReqHeader);
/** Generate request service instance mapper **/
N_ServiceInstMapper req = new N_ServiceInstMapper();
/** Generate OAM data **/
nOAMInstMapper oam = new nOAMInstMapper();
/** Scheduling a job for service creation **/
SchedReqMapper scheduler = new SchedReqMapper();
The service input requires information for request header
Then we require details like service name, port details (including Qos details), customer, OAM details, SAP and port parameters.
Service attributes, port details and QoS are consolidated in N_ServiceInstMapper
This data is populated from the input file and the templates mentioned in the input.
private void generateServiceInstMapper(OMSRestTemplate restTemplate,N_ServiceInstMapper req,CreateEthernetServiceInfo svcInfo){
req.setAuthor(svcInfo.getAuthor());
req.setCustomerName(svcInfo.getCustomerName());
req.setServiceName(svcInfo.getServiceName());
req.setServiceType(svcInfo.getServiceType());
req.setTargetManagementState("Deploying");
req.setManagementState("New");
Map<String, String> additionalInfo = new HashMap<String, String>();
additionalInfo.put("key", "value");
/**
* From service template derive
* 1. OAM template
* 2. QoS template
* **/
req.setReserveResource(svcInfo.getReserveResource().equals("1")?true:false);
req.setShgDescription(svcInfo.getShgDescription());
req.setShgName(svcInfo.getShgName());
req.setDescription(svcInfo.getServiceDescription());
req.setAdditionalInfo(additionalInfo);
}
Service template is used to derive OAM details, Qos Details etc.
REST call used for service template:
REST call: /esmBrowser/svcTemplate/getServiceTemplate/
Input Parameter : service template name with full path
REST call used for QoS Details:
REST call : /esmService/policyBrowser/getPolicyDetailsByName/
Input Parameter : Qos policy Name with full path
REST call used for OAM Template details
REST call : /oamTemplateBrowser/GetOamMaDetailsFromTemplateAndMaName/
Input parameters : Oam template name with full path and maintenance name associated with oam template
private void generateServiceDetails(OMSRestTemplate restTemplate, N_ServiceInstMapper req, nOAMInstMapper oam,
CreateEthernetServiceInfo svcInfo, List<N_RateData> nRateData) {
List<ServicePortInfo> uniPortInfo = svcInfo.getUniPortInfo();
List<N_PortPolicyIdMapper> portQos = new ArrayList<N_PortPolicyIdMapper>();
/**Getting service template details to derive data for service deploy
*REST call: "/esmBrowser/svcTemplate/getServiceTemplate/"<serviceTemplateFullPath>
*Input: service template name with full path
*Output: Instance of type <SvcTemplateHolder>
**/
String serviceTemplateFullPath = svcInfo.getServiceTemplateFullPath();
serviceTemplateFullPath = serviceTemplateFullPath.replace("/", "+");
String serviceTemplateUrl = restTemplate.getUrlPrefix() + "/esmBrowser/svcTemplate/getServiceTemplate/" + serviceTemplateFullPath;
SvcTemplateHolder svcTemplate = restTemplate.getForObject(serviceTemplateUrl, SvcTemplateHolder.class);
/**1. Deriving QoS details**/
List<nPolicyName> policyListFromTmpl = svcTemplate.getPolicyPortList();
String uniPolicyName = "";
String nniPolicyName = "";
Iterator<nPolicyName> policyListTmplItr = policyListFromTmpl.iterator();
while (policyListTmplItr.hasNext()){
nPolicyName policy = policyListTmplItr.next();
/** Obtaining UNI policy name from service template**/
if (policy.getPortMode().equalsIgnoreCase("UNI")){
uniPolicyName = policy.getPolicyName();
/** Obtaining NNI policy name from service template**/
} else if (policy.getPortMode().equalsIgnoreCase("I-NNI")){
nniPolicyName = policy.getPolicyName();
}
}
uniPolicyName = uniPolicyName.replace("/", "+");
/**Obtaining policy id and other details of each QoS policy, this is used in generating end points info**/
/**1. Obtaining QoS details of UNI policy details
* REST call used : "/esmService/policyBrowser/getPolicyDetailsByName/"<uniPolicyName>
* input: policyName
* output: instance of type <N_PolicyInst>
**/
String qosUrl = restTemplate.getUrlPrefix() + "/esmService/policyBrowser/getPolicyDetailsByName/"+uniPolicyName;
N_PolicyInst qosDetailsUNI = restTemplate.getForObject(qosUrl, N_PolicyInst.class);
/**Obtaining policy id and other details of each QoS policy, this is used in generating end points info**/
/**1. Obtaining QoS details of NNI policy details
* REST call used : "/esmService/policyBrowser/getPolicyDetailsByName/"<nniPolicyName>
* input: policyName
* output: instance of type <N_PolicyInst>
**/
nniPolicyName = nniPolicyName.replace("/", "+");
qosUrl = restTemplate.getUrlPrefix() + "/esmService/policyBrowser/getPolicyDetailsByName/"+nniPolicyName;
N_PolicyInst qosDetailsNNI = restTemplate.getForObject(qosUrl, N_PolicyInst.class);
/** Fetching Oam attribute details from oam template associated with service template**/
/** REST call : "/oamTemplateBrowser/GetOamMaDetailsFromTemplateAndMaName/<oamTemplateFullPath>/<OAM_MaName>"
* input : full path of OAM template, maintenance association name associated to the template
* output : instance of <OAMTemplateMAHolderList>
**/
String oamTemplate = svcTemplate.getOamTemplateName();
String oamTemplateFullPath = svcTemplate.getOamTemplatePath()+"/"+oamTemplate;
oamTemplateFullPath = oamTemplateFullPath.replace("/", "+");
String oamUrl = restTemplate.getUrlPrefix() + "/oamTemplateBrowser/GetOamMaDetailsFromTemplateAndMaName/"
+ oamTemplateFullPath + "/" + svcTemplate.getOamMaNAme();
OAMTemplateMAHolderList oamTemplateDetails = restTemplate.getForObject(oamUrl, OAMTemplateMAHolderList.class);
Set<Integer> vsIdSet = generateNNIDetailsFromRingName(restTemplate, req, svcInfo, portQos, nniPolicyName,qosDetailsNNI);
generateNNIDetailsFromLinkNames(restTemplate, req, svcInfo, portQos, nniPolicyName, qosDetailsNNI, vsIdSet);
String vsIdListStr = "";
for (Integer vsId :vsIdSet) {
vsIdListStr = vsIdListStr + vsId.toString() + ",";
}
vsIdListStr = vsIdListStr.substring(0, vsIdListStr.length()-1);
generateCVLAN_SVLANValues(restTemplate, req, svcInfo, vsIdListStr);
if (!svcInfo.getRingHubNode().equalsIgnoreCase("")) {
generateHubNodeDetails(restTemplate, req, svcInfo);
}
generateOAMDetails(restTemplate, oam, svcTemplate, oamTemplateDetails);
generateServiceParameters(req, svcInfo, svcTemplate);
generateUNI_QoSDetails(restTemplate, req, svcInfo, nRateData, uniPortInfo, portQos, svcTemplate, uniPolicyName,qosDetailsUNI);
}
From the ring name the topology details are derived each link and its end points are derived .
For the ERP details:
REST call(s):
REST call used: /esmBrowser/topoService/GetERPDetailsJSON/
Input Parameters : The ERP Name
The NNI end point details are generated from this data and also the NNI policy details derived earlier are associated to each NNI port.
private Set<Integer> generateNNIDetailsFromRingName(OMSRestTemplate restTemplate, N_ServiceInstMapper req,
CreateEthernetServiceInfo svcInfo, List<N_PortPolicyIdMapper> portQos, String nniPolicyName,N_PolicyInst qosDetailsNNI) {
List<String> nmlRingNameList = new ArrayList<String>();
Set<Integer> vsIdSet = new HashSet<Integer>() ;
String vsIdList = "0";
List<String> ringNames = svcInfo.getRingNames();
Iterator<String> ringNamesItr = ringNames.iterator();
while (ringNamesItr.hasNext()) {
String ringName = ringNamesItr.next();
nmlRingNameList.add(ringName);
String getERPDetailsURL = restTemplate.getUrlPrefix() + "/esmBrowser/topoService/GetERPDetailsJSON/" + ringName;
ERPTopologyDataHolderList erpDetailsList = restTemplate.getForObject(getERPDetailsURL, ERPTopologyDataHolderList.class);
List<nNEDataMapper> nNeDataMapperList = erpDetailsList.getnNeDataMapper();
Iterator<nNEDataMapper> neDataItr = nNeDataMapperList.iterator();
while (neDataItr.hasNext()) {
nNEDataMapper neData = neDataItr.next();
vsIdSet.add(neData.getFarEndNodeVSID());
vsIdSet.add(neData.getRingNodeVSID());
N_PortPolicyIdMapper portQosData = new N_PortPolicyIdMapper();
N_EthportMapper port = new N_EthportMapper();
N_PolicyId policyId = new N_PolicyId();
String uniUrl = restTemplate.getUrlPrefix() + "/esmBrowser/service/getEndPointDetails/"
+ neData.getRingPort() + "/" + neData.getRingNode()+ "/" + svcInfo.getServiceType();
ServiceEndPoints svcEndPtDetails = restTemplate.getForObject(uniUrl, ServiceEndPoints.class);
port.setNeName(svcEndPtDetails.getNENAME());
port.setTpID(svcEndPtDetails.getTPID());
/*if(uniEndPt.getTpNativeName().contains("LAG")){
port.setEndpointType("LAG");*//**LAG,PORT<MCLAG**//*
}else if(uniEndPt.getTpNativeName().contains("PORT")){
port.setEndpointType("PORT");
}*/
port.setPortType(CommonDefs.portMode.PORTMODE_UPLINK.name());
port.setMclagId(0);
port.setPortName(neData.getRingPort());
port.setPortRole(CommonDefs.portMode.PORTMODE_UPLINK.name());
policyId.setPolicyId(qosDetailsNNI.getPolicyID());
policyId.setPolicyType("I-NNI");
policyId.setPolicyName(nniPolicyName.replace("+", "/"));
portQosData.setPort(port);
portQosData.setPolicyId(policyId);
portQos.add(portQosData);
N_PortPolicyIdMapper portQosData2 = new N_PortPolicyIdMapper();
N_EthportMapper port2 = new N_EthportMapper();
N_PolicyId policyId2 = new N_PolicyId();
uniUrl = restTemplate.getUrlPrefix() + "/esmBrowser/service/getEndPointDetails/"
+ neData.getFarEndPort() + "/" +neData.getFarEndNode()+ "/" + svcInfo.getServiceType();
svcEndPtDetails = restTemplate.getForObject(uniUrl, ServiceEndPoints.class);
port2.setNeName(svcEndPtDetails.getNENAME());
port2.setTpID(svcEndPtDetails.getTPID());
/*if(uniEndPt.getTpNativeName().contains("LAG")){
port.setEndpointType("LAG");*//**LAG,PORT<MCLAG**//*
}else if(uniEndPt.getTpNativeName().contains("PORT")){
port.setEndpointType("PORT");
}*/
port2.setPortType(CommonDefs.portMode.PORTMODE_UPLINK.name());
port2.setMclagId(0);
port2.setPortRole(CommonDefs.portMode.PORTMODE_UPLINK.name());
port2.setPortName(neData.getFarEndPort());
policyId2.setPolicyId(qosDetailsNNI.getPolicyID());
policyId2.setPolicyType("I-NNI");
policyId2.setPolicyName(nniPolicyName.replace("+", "/"));
portQosData2.setPort(port2);
portQosData2.setPolicyId(policyId2);
portQos.add(portQosData2);
}
/**Get ring end points and set port Qos Data**/
}
if (!nmlRingNameList.isEmpty()) {
req.setNmlRingNameList(nmlRingNameList);
}
return vsIdSet;
}
Here we show how topology details can be derived from link names. A service can have a mixed topology. Part of which is protected path and part containing links only.
Though the service creation example is purely a protected service yet here we see how topology details are derived f link names are present.
From the link names the topology details are derived .For each link and its end points are derived .
For the Link details:
REST call used: /esmBrowser/carrierLinks/getLinkDetailsByUserLabel
Input Parameters : none
Input Request Object : Instance of CarrierEthernetLinkUIData with userlabel set as in input
The NNI end point details are generated from this data and also the NNI policy details derived earlier are associated to each NNI port.
private void generateNNIDetailsFromLinkNames(OMSRestTemplate restTemplate, N_ServiceInstMapper req,
CreateEthernetServiceInfo svcInfo, List<N_PortPolicyIdMapper> portQos, String nniPolicyName,
N_PolicyInst qosDetailsNNI, Set<Integer> vsIdSet) {
List<String> linkNames = svcInfo.getLinkNames();
Iterator<String> linkNamesItr = linkNames.iterator();
List<OtnInterfaceLinkUIData> nmlLinkDataList = new ArrayList<OtnInterfaceLinkUIData>();
if (!linkNames.isEmpty()) {
while (linkNamesItr.hasNext()) {
String userLabel = linkNamesItr.next();
if (!userLabel.equalsIgnoreCase("")) {
OtnInterfaceLinkUIData linkDat = new OtnInterfaceLinkUIData();
CarrierEthernetLinkUIData reqObj = new CarrierEthernetLinkUIData();
CarrierEthernetLinkUIData resObj = new CarrierEthernetLinkUIData();
reqObj.setUSERLABEL(userLabel);
resObj = restTemplate.postForObject(
restTemplate.getUrlPrefix() + "/esmBrowser/carrierLinks/getLinkDetailsByUserLabel", reqObj,
CarrierEthernetLinkUIData.class);
linkDat.setUSERLABEL(userLabel);
linkDat.setLINKID(resObj.getLINKID());
linkDat.setSRCNENAME(resObj.getSRCNENAME());
linkDat.setSRCTPNATIVENAME(resObj.getSRCTPNATIVENAME());
linkDat.setSINKNENAME(resObj.getSINKNENAME());
linkDat.setSINKTPNATIVENAME(resObj.getSINKTPNATIVENAME());
linkDat.setTYPE("LINK"); //LAGLINK or LINK
if (resObj != null) {
vsIdSet.add(resObj.getSrcVSID());
vsIdSet.add(resObj.getSinkVSID());
}
nmlLinkDataList.add(linkDat);
N_PortPolicyIdMapper portQosData = new N_PortPolicyIdMapper();
N_EthportMapper port = new N_EthportMapper();
N_PolicyId policyId = new N_PolicyId();
String uniUrl = restTemplate.getUrlPrefix() + "/esmBrowser/service/getEndPointDetails/"
+ linkDat.getSRCTPNATIVENAME() + "/" + linkDat.getSRCNENAME()+ "/" + svcInfo.getServiceType();
ServiceEndPoints svcEndPtDetails = restTemplate.getForObject(uniUrl, ServiceEndPoints.class);
port.setNeName(svcEndPtDetails.getNENAME());
port.setTpID(svcEndPtDetails.getTPID());
/*if(uniEndPt.getTpNativeName().contains("LAG")){
port.setEndpointType("LAG");*//**LAG,PORT<MCLAG**//*
}else if(uniEndPt.getTpNativeName().contains("PORT")){
port.setEndpointType("PORT");
}*/
port.setPortName(linkDat.getSRCTPNATIVENAME());
port.setPortType(CommonDefs.portMode.PORTMODE_UPLINK.name());
port.setMclagId(0);
port.setPortRole(CommonDefs.portMode.PORTMODE_UPLINK.name());
policyId.setPolicyId(qosDetailsNNI.getPolicyID());
policyId.setPolicyType("I-NNI");
policyId.setPolicyName(nniPolicyName.replace("+", "/"));
portQosData.setPort(port);
portQosData.setPolicyId(policyId);
portQos.add(portQosData);
N_PortPolicyIdMapper portQosData2 = new N_PortPolicyIdMapper();
N_EthportMapper port2 = new N_EthportMapper();
N_PolicyId policyId2 = new N_PolicyId();
uniUrl = restTemplate.getUrlPrefix() + "/esmBrowser/service/getEndPointDetails/"
+ linkDat.getSINKTPNATIVENAME() + "/" + linkDat.getSINKNENAME()+ "/" + svcInfo.getServiceType();
svcEndPtDetails = restTemplate.getForObject(uniUrl, ServiceEndPoints.class);
port2.setNeName(svcEndPtDetails.getNENAME());
port2.setTpID(svcEndPtDetails.getTPID());
/*if(uniEndPt.getTpNativeName().contains("LAG")){
port.setEndpointType("LAG");*//**LAG,PORT<MCLAG**//*
}else if(uniEndPt.getTpNativeName().contains("PORT")){
port.setEndpointType("PORT");
}*/
port2.setPortType(CommonDefs.portMode.PORTMODE_UPLINK.name());
port2.setMclagId(0);
port2.setPortName(linkDat.getSINKTPNATIVENAME());
port2.setPortRole(CommonDefs.portMode.PORTMODE_UPLINK.name());
policyId2.setPolicyId(qosDetailsNNI.getPolicyID());
policyId2.setPolicyType("I-NNI");
policyId2.setPolicyName(nniPolicyName.replace("+", "/"));
portQosData2.setPort(port2);
portQosData2.setPolicyId(policyId2);
portQos.add(portQosData2);
}
}//end while
}
req.setNmlLinkDataList(nmlLinkDataList);
}
Here we use the service template details to know the OAM template name and the maintenance association name associated to the OAM template.
REST call used: /oamTemplateBrowser/GetOamMaDetailsFromTemplateAndMaName/
Input parameters: OAM template name with full path, and oam ma name from service template fetched earlier
String oamTemplate = svcTemplate.getOamTemplateName();
String oamTemplateFullPath = svcTemplate.getOamTemplatePath()+"/"+oamTemplate;
oamTemplateFullPath = oamTemplateFullPath.replace("/", "+");
String oamUrl = restTemplate.getUrlPrefix() + "/oamTemplateBrowser/GetOamMaDetailsFromTemplateAndMaName/"
+ oamTemplateFullPath + "/" + svcTemplate.getOamMaNAme();
OAMTemplateMAHolderList oamTemplateDetails = restTemplate.getForObject(oamUrl, OAMTemplateMAHolderList.class);
The user input for maintenance association name is a 10 letter name. Last four of the digits are derived by the system.
REST call used: /esmBrowser/getNextMaMask
private void generateOAMDetails(OMSRestTemplate restTemplate, nOAMInstMapper oam, SvcTemplateHolder svcTemplate,
OAMTemplateMAHolderList oamTemplateDetails) {
/**This is not required during deployment
* By default if OAM isconfigured all meps are configured as
* remote meps of each other**/
//oam.setElementaryMepList(elementaryMepList);
oam.setMdFormat("NONE");
oam.setMdLevel(svcTemplate.getOamMdLevel());
/**Attribute not set during deployment/save**/
//oam.setTemplateName(templateName);
nMAInstMapper maInst = new nMAInstMapper();
/**This is not required during deployment
* By default if OAM isconfigured all meps are configured as
* remote meps of each other**/
//maInst.setRemteMepList(remoteMepInstList);
OAMTemplateMAHolder OAMTemplateMAHolders = oamTemplateDetails.getOAMTemplateMAHolders().get(0);
maInst.setCcmInterval(OAMTemplateMAHolders.getCcmInterval());
maInst.setMaFormat(OAMTemplateMAHolders.getMaFormat());
maInst.setMhfCreation(OAMTemplateMAHolders.getMhfCreation());
SystemValue maMask = restTemplate.getForObject(restTemplate.getUrlPrefix() + "/esmBrowser/getNextMaMask", SystemValue.class);
maInst.setMaName(OAMTemplateMAHolders.getMaName()+maMask.getSystemValue());
nMEPInstMapper mep = new nMEPInstMapper();
mep.setActive(OAMTemplateMAHolders.getActive().equalsIgnoreCase("true")?true:false);
mep.setControlMepEnabled(OAMTemplateMAHolders.getControlMep().equalsIgnoreCase("true")?true:false);
mep.setInterfaceType(OAMTemplateMAHolders.getInterfaceType());
mep.setLowestPriorityDeffect(OAMTemplateMAHolders.getLowestPriorityDefect());
// mep.setPropagateHoldTime(OAMTemplateMAHolders.getp);
// mep.setStandbyMepShutdownEnabled(standbyMepShutdownEnabled);
mep.setUpDirectionally(OAMTemplateMAHolders.getDirection().equalsIgnoreCase("UP")?true:false);
nMepCCMInstMapper ccm = new nMepCCMInstMapper();
nMepAISInstMapper ais = new nMepAISInstMapper();
ccm.setCcmEnabled(OAMTemplateMAHolders.getCcmEnable().equalsIgnoreCase("true")?true:false);
ccm.setPriority(OAMTemplateMAHolders.getCcmPriority());
mep.setCcm(ccm);
ais.setAisEnabled(OAMTemplateMAHolders.getAisEnable().equalsIgnoreCase("true")?true:false);
ais.setInterval(OAMTemplateMAHolders.getAisInterval());
ais.setPriority(OAMTemplateMAHolders.getAisPriority());
List<Integer> levels = new ArrayList<Integer>();
if (OAMTemplateMAHolders.isAisLevel1()==true)levels.add(1);
if (OAMTemplateMAHolders.isAisLevel2()==true)levels.add(2);
if (OAMTemplateMAHolders.isAisLevel3()==true)levels.add(3);
if (OAMTemplateMAHolders.isAisLevel4()==true)levels.add(4);
if (OAMTemplateMAHolders.isAisLevel5()==true)levels.add(5);
if (OAMTemplateMAHolders.isAisLevel6()==true)levels.add(6);
if (OAMTemplateMAHolders.isAisLevel7()==true)levels.add(7);
ais.setLevels(levels);
mep.setAis(ais);
maInst.setMep(mep);
oam.setMaInst(maInst);
}
An end point can be a port, LAG and MC-LAG. For each end point its details are derived.
REST call for end point details
REST call : "/esmBrowser/service/getEndPointDetails/"
Input Parameters : TP native name in format <pack_name>-<shelf>-<slot>-<endpointname>, Node name and service type.
REST call for MC-LAG details:
REST call : /esmBrowser/MCLAG/getAllMCLAGConfigs/
Input Parameters : local TimeZone Offset, input string -"MCLAG", input mclag name
private void generateUNI_QoSDetails(OMSRestTemplate restTemplate, N_ServiceInstMapper req,
CreateEthernetServiceInfo svcInfo, List<N_RateData> nRateData, List<ServicePortInfo> uniPortInfo,
List<N_PortPolicyIdMapper> portQos, SvcTemplateHolder svcTemplate, String uniPolicyName,
N_PolicyInst qosDetailsUNI) {
/**Fetching details of port by port name (TPNATIVENAME)**/
Iterator<ServicePortInfo> uniPortItr = uniPortInfo.iterator();
while (uniPortItr.hasNext()) {
/**Below code only for LAG and PORT End point types**/
ServicePortInfo uniEndPt = uniPortItr.next();
String uniUrl = restTemplate.getUrlPrefix() + "/esmBrowser/service/getEndPointDetails/"
+ uniEndPt.getTpNativeName() + "/" + uniEndPt.getNodeName() + "/" + svcInfo.getServiceType();
ServiceEndPoints svcEndPtDetails = restTemplate.getForObject(uniUrl, ServiceEndPoints.classong>);
if(uniEndPt.getTpNativeName().contains("LAG")){
//port.setEndpointType("LAG");/**LAG,PORT<MCLAG**/
N_PortPolicyIdMapper portQosData = setUniDetails(svcInfo, svcTemplate, uniPolicyName, qosDetailsUNI,
uniEndPt, svcEndPtDetails,nRateData);
portQos.add(portQosData);
}else if (!uniEndPt.getTpNativeName().equalsIgnoreCase("")){
N_PortPolicyIdMapper portQosData = setUniDetails(svcInfo, svcTemplate, uniPolicyName, qosDetailsUNI,
uniEndPt, svcEndPtDetails,nRateData);
portQos.add(portQosData);
//port.setEndpointType("PORT");
}else{
/** MCLAG DATA HANDLED SEPARATELY**/
/**MCLAG**/
/**For MCLAG as end point given mclag config name
* Finding out LAG end points and updating mclagId for each of this UNI points
* **/
TimeZone tz = TimeZone.getDefault();
Calendar cal = GregorianCalendar.getInstance(tz);
int offsetInMillis = tz.getOffset(cal.getTimeInMillis());
String offset = String.format("%02d:%02d", Math._abs_(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60));
offset = (offsetInMillis >= 0 ? "+" : "-") + offset;
String localTimeZoneOffset = offset;
String selectedMcLagName = uniEndPt.getMclagConfigName();
String mclagUrl = restTemplate.getUrlPrefix() + "/oms1350/esmBrowser/MCLAG/getAllMCLAGConfigs/"
+ localTimeZoneOffset+"/"+"MCLAG"+"/"+selectedMcLagName;
MCLAGUIConfigDataList mclagConfigData = restTemplate.getForObject(mclagUrl, MCLAGUIConfigDataList.class);
List<MCLAGUIConfigData> mclagConfigDataList = mclagConfigData.getMclagUIConfigDataList();
if (mclagConfigDataList != null ){
MCLAGUIConfigData mclagDat = mclagConfigDataList.get(0);
Integer mclagId = Integer.parseInt(mclagDat.getMclagConfigHandle());
/** Get mclag member list from MCLAG config handle**/
//"getMCLagMemberDetailsDataList/{mclagId}"
String lagsUrl = restTemplate.getUrlPrefix() + "/oms1350/esmBrowser/MCLAG/getMCLagMemberDetailsDataList/"
+ mclagId;
LagUIMCLagMemberDetailsDataList lagMemberData = restTemplate.getForObject(mclagUrl, LagUIMCLagMemberDetailsDataList.class);
List<LAGUIMCLagMemberDetailsData> lagUiMemberDetailsDataList = lagMemberData.getLagUiMemberDetailsDataList();
Iterator<LAGUIMCLagMemberDetailsData> lagItr = lagUiMemberDetailsDataList.iterator();
List<ServicePortInfo> uniEndPtList = new ArrayList<ServicePortInfo>();
while (lagItr.hasNext()) {
LAGUIMCLagMemberDetailsData lagdat = lagItr.next();
ServicePortInfo uniEnd = new ServicePortInfo();
uniEnd.setTpNativeName(lagdat.getLag1());
uniEnd.setNodeName(lagdat.getNE1());
uniEnd.setAccessCVLAN(uniEndPt.getAccessCVLAN());
uniEnd.setAccessSVLAN(uniEndPt.getAccessSVLAN());
uniEnd.setEndPointRole(uniEndPt.getEndPointRole());
N_PortPolicyIdMapper portQosData = setUniDetails(svcInfo, svcTemplate, uniPolicyName, qosDetailsUNI,
uniEnd, svcEndPtDetails,nRateData);
portQosData.getPort().setMclagId(mclagId);
portQos.add(portQosData);
ServicePortInfo uniEnd2 = new ServicePortInfo();
uniEnd2.setTpNativeName(lagdat.getLag2());
uniEnd2.setNodeName(lagdat.getNE2());
uniEnd2.setAccessCVLAN(uniEndPt.getAccessCVLAN());
uniEnd2.setAccessSVLAN(uniEndPt.getAccessSVLAN());
uniEnd2.setEndPointRole(uniEndPt.getEndPointRole());
N_PortPolicyIdMapper portQosData2 = setUniDetails(svcInfo, svcTemplate, uniPolicyName, qosDetailsUNI,uniEnd2, svcEndPtDetails,nRateData);
portQosData2.getPort().setMclagId(mclagId);
portQos.add(portQosData2);
}
}
}
}//end while
req.setPortQos(portQos);
}
private N_PortPolicyIdMapper setUniDetails(CreateEthernetServiceInfo svcInfo, SvcTemplateHolder svcTemplate,
String uniPolicyName, N_PolicyInst qosDetailsUNI, ServicePortInfo uniEndPt,
ServiceEndPoints svcEndPtDetails,List<N_RateData> nRateDataList) {
N_PortPolicyIdMapper portQosData = new N_PortPolicyIdMapper();
N_EthportMapper port = new N_EthportMapper();
N_PolicyId policyId = new N_PolicyId();
if (uniEndPt.getTpNativeName().contains("LAG")) {
port.setEndpointType("LAG"); /**LAG,PORT<MCLAG**/
} else if !uniEndPt.getTpNativeName().equalsIgnoreCase("")) {
port.setEndpointType("PORT");
}
port.setNeName(svcEndPtDetails.getNENAME());
port.setPortName(uniEndPt.getTpNativeName());
port.setTpID(svcEndPtDetails.getTPID());
port.setPortType(CommonDefs.portMode.PORTMODE_ACCESS.name());
port.setPortRole(CommonDefs.portMode.PORTMODE_ACCESS.name());
if (!uniEndPt.getAccessCVLAN().equalsIgnoreCase("")) {
port.setAccessCVLANEnabled(true);
} else {
port.setAccessCVLANEnabled(false);
}
if (!uniEndPt.getAccessSVLAN().equalsIgnoreCase("")) {
port.setAccessSVLANEnabled(true);
} else {
port.setAccessSVLANEnabled(false);
}
port.setAccessCVLAN(uniEndPt.getAccessCVLAN());
port.setAccessSVLAN(uniEndPt.getAccessSVLAN());
if (svcInfo.getServiceType().toUpperCase().contains("TREE")) {
port.setHubAndSpoke(uniEndPt.getEndPointRole());
}
if (!uniEndPt.getFrameType().equalsIgnoreCase("")) {
port.setFragmentType(Integer.parseInt(uniEndPt.getFrameType())); /**1 all frames; 2 tagged frames**/
}
port.setMclagId(0);
policyId.setPolicyId(qosDetailsUNI.getPolicyID());
policyId.setPolicyType("UNI");
policyId.setPolicyName(uniPolicyName.replace("+", "/"));
portQosData.setPort(port);
portQosData.setPolicyId(policyId);
/* private long tpId;
*//**
* Map containing: -egressRate -egressMaxBurstRate -aggMeterRate -aggMeterBusrtrate
*//*
private Map<String, String> rateParams = new HashMap<String, String>();
*//**
* Map containing: -pack level attributes - Frame-based Accounting :
* Key : IngressEnabled Value : Enabled(1)/Disabled(0)
* Key : EgressEnabled Value : Enabled(1)/Disabled(0)
*//*
private Map<String, String> packParams = new HashMap<String, String>();
*/
generateRateDetails(svcTemplate, svcEndPtDetails, nRateDataList);
return portQosData;
}
Service parameters are set based on input parameters
private void generateServiceParameters(N_ServiceInstMapper req, CreateEthernetServiceInfo svcInfo,
SvcTemplateHolder svcTemplate) {
ServiceParams svcParams = new ServiceParams();
svcParams.setL2cp(svcTemplate.getL2ptEnabled());
svcParams.setL2pt(svcTemplate.getL2ptEnabled());
svcParams.setLlf(svcTemplate.getLlfEnabled());
svcParams.setLacp(svcTemplate.getLacpEnabled());
svcParams.setEplOp2TunnelEnabled(svcTemplate.getEplOp2TunnelEnabled());
svcParams.setFragmentType(svcInfo.getFragmentType() == ""?0:Integer.parseInt(svcInfo.getFragmentType()));
if (!svcInfo.getCvlanRangeValue().equalsIgnoreCase("")) {
svcParams.setVlanRangeEnabled(1);
} else {
svcParams.setVlanRangeEnabled(0);
}
req.setSvcParams(svcParams);
}
Rate parameters to be applied at each SAP and Port are configured as below deriving this information also from service template as mentioned in the json input file.
private void generateRateDetails(SvcTemplateHolder svcTemplate, ServiceEndPoints svcEndPtDetails,List<N_RateData> nRateDataList) {
N_RateData nRateDat = new N_RateData();
nRateDat.setTpId(svcEndPtDetails.getTPID());
Map<String, String> packParams = new HashMap<String, String>();
nRateDat.setPackParams(packParams);
Map<String, String> rateParams = new HashMap<String, String>();
nRateDat.setRateParams(rateParams);
rateParams.put(CommonDefs.PORT_PARAMS_EG_RATE_NAME, svcTemplate.getEgressRate());
rateParams.put(CommonDefs.PORT_PARAMS_EG_MAX_BURSTSIZE_NAME, svcTemplate.getEgressMaxBurst());
rateParams.put(CommonDefs.SAP_PARAMS_AGG_METER_RATE, svcTemplate.getAggMeterRate());
rateParams.put(CommonDefs.SAP_PARAMS_AGG_METER_BURST_SIZE, svcTemplate.getAggMeterBurst());
packParams.put(CommonDefs.INGRESS_ENABLED, svcTemplate.getIngressEnabled()==0?"0":"1");
packParams.put(CommonDefs.EGRESS_ENABLED, svcTemplate.getEgressEnabled()==0?"0":"1");
nRateDataList.add(nRateDat);
}