aboutsummaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-dmaap-adapter
AgeCommit message (Expand)AuthorFilesLines
2017-09-15Changing to mariadb java clientPatrick Brady3-3/+3
2017-09-07Change to CCSDK and ODL CarbonPatrick Brady7-35/+21
2017-08-11Fixing dmaap authentication exceptionPatrick Brady1-10/+6
2017-08-02Merging in bug fixesPatrick Brady4-13/+27
2017-07-20Applying license changes to all filesPatrick Brady41-123/+205
2017-06-06Updating licenses in all filesPatrick Brady41-123/+164
2017-06-05Fixing logic in an if statementPatrick Brady1-1/+1
2017-06-02Merge of new rebased codePatrick Brady42-97/+2105
2017-05-16Remove commented methods/fields in APPCMarcus G K Williams1-8/+0
2017-04-18Modifying feature install scriptsPatrick Brady1-2/+22
2017-04-05Updating properties for Opendaylight BoronPatrick Brady1-1/+1
2017-03-31Root pom parent and other cleanupPatrick Brady1-8/+1
2017-03-10Updating master to 1.1.0-SNAPSHOTPatrick Brady4-5/+5
2017-02-24Changing to snapshot versionPatrick Brady4-5/+5
2017-02-15Moving all files to root directoryPatrick Brady29-0/+2058
eric.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*-
 * ============LICENSE_START=======================================================
 * openECOMP : SDN-C
 * ================================================================================
 * Copyright (C) 2017 ONAP Intellectual Property. All rights
 * 						reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdnc.ra.check;

import java.util.Map;

import org.openecomp.sdnc.ra.comp.EquipmentCheck;
import org.openecomp.sdnc.ra.comp.ServiceData;
import org.openecomp.sdnc.ra.equip.data.EquipmentData;
import org.openecomp.sdnc.rm.comp.ResourceManager;
import org.openecomp.sdnc.rm.data.AllocationItem;
import org.openecomp.sdnc.rm.data.Resource;
import org.openecomp.sdnc.util.vrf.VpnParam;
import org.openecomp.sdnc.util.vrf.VrfUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OneMVrfCheck implements EquipmentCheck {

	private static final Logger log = LoggerFactory.getLogger(OneMVrfCheck.class);

	private ResourceManager resourceManager;

	@Override
	public boolean checkEquipment(
	        String endPointPosition,
	        ServiceData serviceData,
	        EquipmentData equipData,
	        Map<String, Object> equipmentConstraints) {
		String vrfName = (String) serviceData.data.get("vrf-name");
		if (vrfName == null)
			return true;

		String v4MulticastStr = (String) serviceData.data.get("v4-multicast");
		String v6MulticastStr = (String) serviceData.data.get("v6-multicast");
		boolean v4Multicast = v4MulticastStr != null &&
		        (v4MulticastStr.equalsIgnoreCase("Y") || v4MulticastStr.equalsIgnoreCase("true"));
		boolean v6Multicast = v6MulticastStr != null &&
		        (v6MulticastStr.equalsIgnoreCase("Y") || v6MulticastStr.equalsIgnoreCase("true"));
		if (!v4Multicast && !v6Multicast)
			return true;

		// First check if a new VRF would be required. If not, we are good
		Resource r = resourceManager.getResource("VRF", equipData.equipmentId);
		if (r != null && r.allocationItems != null)
			for (AllocationItem ai : r.allocationItems)
				if (ai.resourceShareGroupList.contains(vrfName))
					return true;

		String resourceUnionId = serviceData.serviceInstanceId + '/' + serviceData.endPointPosition;

		// Check if there is already another multicast VRF for the same VPN
		VpnParam vpnp = VrfUtil.parseVrfInstanceName(vrfName);
		r = resourceManager.getResource("MVRF", equipData.equipmentId);
		if (r != null && r.allocationItems != null) {
			for (AllocationItem ai : r.allocationItems) {

				// Skip the allocation item for the current service instance, if there, in case it is a change order
				if (ai.resourceUnionId.equals(resourceUnionId))
					continue;

				if (ai.resourceShareGroupList != null && ai.resourceShareGroupList.size() > 0) {
					String vrfName2 = ai.resourceShareGroupList.iterator().next();
					VpnParam vpnp2 = VrfUtil.parseVrfInstanceName(vrfName2);
					if (vpnp.vpnId.equals(vpnp2.vpnId)) {
						log.info("Skipping VPE " + equipData.equipmentId +
						        ": This request requires new multicast VRF, " +
						        "but there is already another multicast VRF for the same VPN: " + vrfName2 + ".");
						return false;
					}
				}
			}
		}

		return true;
	}

	public void setResourceManager(ResourceManager resourceManager) {
		this.resourceManager = resourceManager;
	}
}