summaryrefslogtreecommitdiffstats
path: root/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java')
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java84
1 files changed, 42 insertions, 42 deletions
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java
index d5a691bb..2b90027c 100644
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java
+++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 ONAP Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,54 +23,54 @@ package org.openecomp.sdnc.util.vrf;
public class VrfUtil {
- public static String createVrfInstanceName(
- String serviceInstanceId,
- String vpnId,
- String siteType,
- String routeGroup) {
- if (vpnId == null || vpnId.trim().length() == 0)
- return null;
+ public static String createVrfInstanceName(
+ String serviceInstanceId,
+ String vpnId,
+ String siteType,
+ String routeGroup) {
+ if (vpnId == null || vpnId.trim().length() == 0)
+ return null;
- String ss = "VPN-" + vpnId;
- if (siteType != null && siteType.equalsIgnoreCase("hub"))
- ss += "-HUB";
- if (siteType != null && siteType.equalsIgnoreCase("spoke"))
- ss += "-SP-" + serviceInstanceId;
- if (routeGroup != null && routeGroup.trim().length() > 0)
- ss += "-RG-" + routeGroup;
+ String ss = "VPN-" + vpnId;
+ if (siteType != null && siteType.equalsIgnoreCase("hub"))
+ ss += "-HUB";
+ if (siteType != null && siteType.equalsIgnoreCase("spoke"))
+ ss += "-SP-" + serviceInstanceId;
+ if (routeGroup != null && routeGroup.trim().length() > 0)
+ ss += "-RG-" + routeGroup;
- return ss;
- }
+ return ss;
+ }
- public static VpnParam parseVrfInstanceName(String vrfInstanceName) {
- VpnParam vpnParam = new VpnParam();
+ public static VpnParam parseVrfInstanceName(String vrfInstanceName) {
+ VpnParam vpnParam = new VpnParam();
- int i1 = vrfInstanceName.indexOf("-HUB");
- if (i1 > 0)
- vpnParam.siteType = "HUB";
+ int i1 = vrfInstanceName.indexOf("-HUB");
+ if (i1 > 0)
+ vpnParam.siteType = "HUB";
- int i2 = vrfInstanceName.indexOf("-SP-");
- if (i2 > 0)
- vpnParam.siteType = "SPOKE";
+ int i2 = vrfInstanceName.indexOf("-SP-");
+ if (i2 > 0)
+ vpnParam.siteType = "SPOKE";
- int i3 = vrfInstanceName.indexOf("-RG-");
- if (i3 > 0)
- vpnParam.routeGroupName = vrfInstanceName.substring(i3 + 4);
+ int i3 = vrfInstanceName.indexOf("-RG-");
+ if (i3 > 0)
+ vpnParam.routeGroupName = vrfInstanceName.substring(i3 + 4);
- int i4 = vrfInstanceName.length();
- if (i1 > 0)
- i4 = i1;
- else if (i2 > 0)
- i4 = i2;
- else if (i3 > 0)
- i4 = i3;
- vpnParam.vpnId = vrfInstanceName.substring(4, i4);
+ int i4 = vrfInstanceName.length();
+ if (i1 > 0)
+ i4 = i1;
+ else if (i2 > 0)
+ i4 = i2;
+ else if (i3 > 0)
+ i4 = i3;
+ vpnParam.vpnId = vrfInstanceName.substring(4, i4);
- if (i2 > 0 && i3 < 0)
- vpnParam.spokeServiceInstanceId = vrfInstanceName.substring(i2 + 4);
- if (i2 > 0 && i3 > 0)
- vpnParam.spokeServiceInstanceId = vrfInstanceName.substring(i2 + 4, i3);
+ if (i2 > 0 && i3 < 0)
+ vpnParam.spokeServiceInstanceId = vrfInstanceName.substring(i2 + 4);
+ if (i2 > 0 && i3 > 0)
+ vpnParam.spokeServiceInstanceId = vrfInstanceName.substring(i2 + 4, i3);
- return vpnParam;
- }
+ return vpnParam;
+ }
}