Initial import of Microsemi Driver

Change-Id: I431d5f2c18e0b66a84c36273c3d9f0b84f223841

Added in BUCK files for building driver

Change-Id: I70681327f5b89f67e904c45d5974ab393652d51f

Corrected some syntax errors

Change-Id: I11150cc499c212005f80619e3900e747f1c23d96

Updated pom file to clean build

Change-Id: I6613ddc9e6802aa882e716cf04df210249870835

Added in utility functions for EA1000 Init

Change-Id: I51ffe0cf0daf9ffcea0e2479ee9982fcd1755440

Added YMS code to Microsemi Driver

Change-Id: I6f2a14e454c6909bf9e9f6025321c74c98c13c72

Updated driver to work with YMS and YCH

Change-Id: If7dbe3cd5bd1b6f902d09d6b2dc3895605d70f70

Implemented IetfSystemManager as a service and call on YMS as a service

Change-Id: If1c5e8482b1f53f578a3b0b770accd50024111cf

Moved YMS calls over in to Yang Service implementation

Change-Id: I044aad06f1ef7452bc48e88987787a683666cd72

improved unit test for IetfSystemManager

Change-Id: I48fbf831e7e5ca0e1ef3de8288e56da1b5ebb7a4

Major changes to IetfSystemManager to work in live system

Change-Id: I6e3aa118ba422151f314b9a666860d90905c9929

Added in retry mechanism for DeviceDescription to wait for YCH

Change-Id: If8e0f2c2f315ffd6db15627a11382a00217dd262

Added in implementation of MseaSaFiltering and unit tests

Change-Id: I34bf888e0e732bd4664d1fb8ef5abb679b1506fe

Updated driver with unit tests for MseaSaFiltering

Change-Id: I7ea2407a546622ff55d1ab21610c45697546d632

Modified removeFlowRules of Ea1000FlowRuleProgrammable

Change-Id: Ibb4a555f61887a8e6e42af588bb42f7b70f58efb

Added in manager for MseaUniEvc service with unit tests

Change-Id: Idc5853f46051548973f52a0659f7f88982ff960c

Implemented getFlowEntries() for EVCs from EA1000

Change-Id: Ie85dadfa7760f0b30a9bdf6ccd09cca9f097fff9

Added in translation of FlowRules in to EVC on EA1000

Change-Id: Icfb65171c3300c96b3ca4e18cbd327f0ed2190be

Added in handling of FlowRule deletion including complex ceVlanMaps

Change-Id: I7fd0bb0ef04d1b40e4b7d6a6db7f7ee662329780

Updated Service entries for new onos-yang-tools

Change-Id: I44e655202f3a45073e1e16f83737caed6e01afa8

Revert "Updated Service entries for new onos-yang-tools"

This reverts commit 642b550ef1de12ed59bad2eaa3a2da414d2e5e59.

Improved timeout mechanism for YANG model loading

Change-Id: If744ecd206372e822edf2b736c83226321a12256

Minor edits of EVC creation

Change-Id: Ib0a4763deaf6dce37625ba77f5095b39cd98272d

Added in CustomEvc and supporting classes

Change-Id: Iad60eb1bcd48d2aec55b894b2d419b51852c3b2f

Created CeVlanUtils to resolve loading problem

Change-Id: I0d63931ad2c5ad2725861ebc7dccc4d5fe7b9298

Modified startup check

Change-Id: I6e6bcfa7e615044cb08fe7ee2f8a6c8b89aabb21

Modified handlin of flow rules

Change-Id: I965a79c23298866122aeb94c6d9d584aafee3bd5

Fixed problem with ceVlanMap

Change-Id: If1458c35d0b95b5b25b6636f098292f9e91c06c6

Minor Pom edits

Change-Id: I5cefb18674aa04b1f50bd7e2306260c1c3ad3814

Commented out extension references in YANG files to avoid onos-yang-tools problems

Change-Id: I32fdb34c4f476f495fe28e75d0f410aaf14e2ec1

Corrected error in removing 0 in CeVlanMapUtils

Change-Id: I8cd1fd02788b81c2613364d5639ef6e090057f80

Changes in YMS to accomodate EA1000 driver

Change-Id: I6ae2b9bd2be49eae8d4ad2f929dfe3214c514550
diff --git a/drivers/microsemi/ea1000yang/src/main/yang/msea-uni-evc-service.yang b/drivers/microsemi/ea1000yang/src/main/yang/msea-uni-evc-service.yang
new file mode 100644
index 0000000..5075ffb
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/yang/msea-uni-evc-service.yang
@@ -0,0 +1,1070 @@
+module msea-uni-evc-service {
+
+	namespace "http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service";
+	prefix "msea-svcs"; //MicroSemi EdgeAssure (msea)
+
+
+	import msea-types {
+		prefix msea;
+		revision-date 2016-02-29;
+	}
+
+//	import ietf-interfaces { prefix if; }
+//	import mef-uni-evc-interface { prefix mef-interface; }
+	import ENTITY-STATE-TC-MIB {prefix "entity-state";}
+
+	/*** META INFORMATION ***/
+
+	organization
+	"Microsemi Inc., FTD Division";
+
+	contact
+	"Web URL: http://www.microsemi.com/
+	E-mail: info@microsemi.com
+	Postal: Microsemi Corporation Corporate Headquarters
+	One Enterprise Aliso Viejo,
+	CA 92656
+	U.S.A.
+	Phone: +1 949 380 6100
+	Fax: +1 949 215-4996";
+
+	description
+	"This YANG module is based on the MEF 40 SNMP model, for the management 
+	objects for the management of User Network Interfaces (UNIs) and Ethernet
+	Virtual Connections (EVCs). It has been converted to YANG and modified
+	slightly to suit the EdgeAssure SFP which has some extra
+	constraints that are not handled by the original model
+
+	Copyright 2016 Microsemi Inc.
+	All rights reserved.";
+
+	reference
+	"***************************************************************************
+	Reference Overview
+
+	A number of base documents have been used to create this MIB. The following
+	are the abbreviations for the baseline documents:
+	[MEF 40] refers to SNMP MIB
+	[MEF6.1] refers to MEF 6.1 'Ethernet Services Definitions - Phase 2',
+	April 2008
+	[MEF 6.1.1] refers to MEF 6.1.1 'Layer 2 Control Protocol Handling Amendment
+	to MEF 6.1', January 2012
+	[MEF 7.2] refers to MEF 7.2 'Carrier Ethernet Management Information Model',
+	January 2013
+	[MEF 10.2] refers to MEF 10.2 'Ethernet Services Attributes Phase 2',
+	October 2009
+	[MEF 26.1] refers to MEF 26.1 'External Network Network Interface (ENNI) -
+	Phase 2', January 2012
+	[Q.840.1] refers to 'ITU-T Requirements and analysis for NMS-EMS
+	management interface of Ethernet over Transport and Metro Ethernet
+	Network (EoT/MEN)', March 2007
+	****************************************************************************";
+
+	revision "2016-03-17" {
+		description
+		"Initial Version. Sean Condon - Microsemi";
+		reference "MEF 6.2";
+	}
+
+	
+
+    
+    grouping uni-attributes {
+    	
+    	description "Common UNI attributes";
+
+		leaf bundling-multiplex { //aka mefServiceUniCfgBundlingMultiplex
+			type enumeration {
+				enum allToOne {
+					description 
+					"All to One Bundling, used for Private services: 
+						EPL, EP-LAN, and EP-Tree";
+				}
+				
+				enum bundling {
+					description 
+						"Bundling, indicates one or more 
+						CE-VLANS per service, used for virtual private CE-VLAN
+						preservation services: EVPL, EVP-LAN, EVP-Tree";
+				}
+						
+				enum multiplex {
+					description 
+						"Service Multiplexing, indicates 
+						one or more EVCs per UNI, used for virtual private
+						CE-VLAN preservation or non-preservation services:
+						EVPL, EVP-LAN, EVP-Tree";
+				}
+				
+				enum bundlingMultiplex {
+					description 
+					"Service Multiplexing plus 
+					Bundling, indicates one or more EVCs per UNI that are
+					composed of one or more CE-VLANs, used for virtual
+					CE-VLAN preservation services: EVPL, EVP-LAN, EVP-Tree";
+				}
+			}
+			
+			default allToOne;
+//			msea:not-changeable;
+
+			description
+				"Configures bundling and multiplexing options for the UNI. This object
+				is an enumerated list of possible multiplexing and bundling options
+				on a UNI that is unambiguous and provides only the legal possibilities.";
+
+			reference
+				"[MEF 6.1] 6.0, [MEF 7.2] 6.2.1.2";
+		}
+
+    }
+    
+	
+	grouping evc-per-uni-extension-attributes {
+		description "EVC attributes that are configured depending on
+				the UNI side.";
+
+		leaf ce-vlan-map { //aka mefServiceEvcPerUniCfgCeVlanMap
+			type msea:service-list-type;
+			
+			mandatory true;
+			description
+			"This object indicates the CE-VLANs associated with the specific
+			EVC on a UNI. CE-VLAN IDs have value of 0 to 4095. The CE-VLAN ID
+			list can be a single value or multiple values separated by a delimiter.
+	
+			Some valid values are: '100', '1:10', '10,20,30', '1:4095'. In the
+			first example only CE-VLAN ID 100 is associated with the VLAN map.
+			In the second example the CE-VLAN map includes CE-VLAN IDs 1 through
+			10 (range of values). The third example indicates three separate values
+			that make up the CE-VLAN map. The last example indicates all CE-VLAN IDs
+			are included in the map (range of values). ";
+			reference
+			"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+		}
+
+		
+		leaf ingress-bwp-group-index { //aka mefServiceEvcPerUniCfgIngressBwpGrpIndex
+			type leafref {
+				path "/msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group/msea-svcs:group-index";
+			}
+			
+			mandatory true;
+	
+			description
+			"This object is the index number of the ingress bandwidth profile group
+			associated with the current EVC on a UNI. A value of 0 indicates that
+			no ingress bandwidth profile group is associated with the EVC on a UNI.
+	
+			This index indicates the specific bandwidth profile group previously
+			configured via mefServiceBwpGrpCfgTable and mefServiceBwpCfgTable
+			using this value for mefServiceBwpGrpCfgIndex. There may be multiple
+			entries in mefServiceBwpCfgTable using this index, each containing
+			bandwidth parameters for a different Class of Service Identifier.";
+			reference
+			"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+		}
+		
+
+        choice tag-manipulation {
+          description "Tag Action to take for an EVC. 
+		  	  If no case is specified then the default noAction will apply";
+          //case noAction - if not specified then noAction will be taken
+          case tagPop {
+          	container tag-pop {
+          		description "Pop the tag.";
+          		presence "Tag pop.";
+          	}
+          }
+          
+          case tagPush {
+          	container tag-push {
+          		description "Push the tag.";
+          		
+        		leaf push-tag-type { //Microsemi Eagle specific configuration attribute
+        			type enumeration {
+        			  enum pushCtag  { description "Use Ctag type on push"; }
+        			  enum pushStag    { description "Use Stag type on push"; }
+        			}
+        			default pushCtag;
+
+        			description 
+        			  "Specify what tag type should be used is if tagAction is 'push'.";
+        			reference   
+        			 "Edge Assure internal API";
+        		}
+        		
+    			leaf outer-tag-vlan { //Microsemi Eagle specific configuration attribute
+    				type msea:vlan-id-type;
+    				mandatory true;
+    				description 
+    				  "The VLan value to use as the outer tag's vlan.";
+    				reference   
+    				 "Edge Assure internal API";
+    			}
+          	}
+          }
+          
+          case tagOverwrite {
+        	  container tag-overwrite {
+        		  description "Overwrite the tag";
+        		  
+        			leaf outer-tag-vlan { //Microsemi Eagle specific configuration attribute
+        				type msea:vlan-id-type;
+        				mandatory true;
+        				description 
+        				  "The VLan value to use as the outer tag's vlan.";
+        				reference   
+        				 "Edge Assure internal API";
+        			}
+        	  }
+          }
+		}
+        
+		leaf evc-per-uni-service-type { //aka mefServiceEvcPerUniCfgServiceType
+			type enumeration {
+				enum epl {
+					description "Ethernet Private Line Service (EPL)
+					Point-to-Point EVC, all to one bundling";
+				}
+				
+				enum evpl {
+					description "Ethernet Virtual Private Line (EVPL)
+					Point-to-Point EVC, bundling and/or multiplexing";
+				}
+				
+				enum eplan {
+					description "Ethernet Private LAN Service (EP-LAN)
+					Multipoint-to-Multipoint EVC, all to one bundling";
+				}
+				
+				enum evplan {
+					description "Ethernet Virtual Private LAN Service (EVP-LAN)
+					Multipoint-to-Multipoint EVC, bundling and/or multiplexing"; 
+				}
+				
+				enum eptree {
+					description "Ethernet Private Tree Service (EP-Tree)
+					Rooted-Multipoint EVC, all to one bundling";
+				}
+				
+				enum evptree {
+					description "Ethernet Virtual Private Tree Service (EVP-Tree)
+					Rooted-Multipoint EVC, bundling and/or multiplexing";
+				}
+			}
+			config false;
+				
+			description
+			"This object indicates the specific Ethernet service type. The value is 
+			derived from the EVC object 'mefServiceEvcCfgType' and the UNI object
+			'mefServiceUniCfgBundlingMultiplex'.";
+	
+			reference
+			"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+		}
+		
+		list flow-mapping {
+			description "A list to track the VLANs relationship to a Flow";
+			key ce-vlan-id;
+			leaf ce-vlan-id {
+				type msea:vlan-id-type;
+				description "A VLan Id";
+			}
+			leaf flow-id {
+				type uint64;
+				description "An identifier for a Flow Rule related to this VLan Id";
+			}
+		}
+	}
+	
+	
+	grouping pcp-color-map-grouping {
+		description "The PCP identifiers for the COS";
+		leaf pcp-id {
+			description "The priority level";
+			type msea:priority-type;
+		}
+		
+		leaf pcp-color {
+			description "The color to apply to this Priority";
+			type msea:cos-color-type;
+//			msea:not-changeable;
+		}
+	}
+	
+	container mef-services {
+		description
+		"This acts as a container of the MEF (6.2) Services configuration.";
+
+		container uni {
+//			must "count(/if:interfaces/if:interface/[mef-interface:mef-service-type = 'bUni2d1']) = 2" {
+//				error-message "The interfaces must be configured as a UNI";
+//				error-app-tag "msea-uni-must-01";
+//			} //Unenforceable as the interface resides in a different module - may have to be implemented in the TransAPI
+
+			presence "If present this device acts as a UNI";
+
+			description "This Edge Assure device support only one UNI.
+				This device supports only one UNI even though it has two interfaces. 
+				One of the interfaces corresponds to the UNI-N side of the UNI, 
+				while the other interface corresponds to the UNI-C side of the interface.
+				Each side performs the mapping to and from the EVC on the ingress
+				of packets to the device.";
+
+		    	
+			leaf name { //aka mefServiceUniCfgIdentifier
+				type msea:identifier45;
+				mandatory true;
+				description
+				"This object indicates the UNI identifier. 
+				MEF 26.1 restricts the maximum size identifiers to 45 octets.";
+				reference
+				"[MEF 6.1] 6.0, [MEF 7.2] 6.2.1.2";
+			}
+			
+			leaf uni-side-interface-assignment {
+				type enumeration {
+					enum uni-c-on-host {
+						description "Uni-C (Customer) is the Host/eth1/LAN  - commonly the System port. 
+							Uni-N (Network) is the Optics/eth0/WAN - commonly the Carrier port";
+					}
+					enum uni-c-on-optics {
+						description "Uni-C (Customer) is the Optics/eth0/WAN - commonly the Carrier port.
+							Uni-N (Network) is the Host/eth1/LAN  - commonly the System port";
+					}
+				}
+				
+				default uni-c-on-host;
+//				msea:not-changeable;
+
+
+				description "An attribute to configure the assignment of UNI-C (Customer) and 
+						UNI-N (Network) to the interfaces.
+						This Edge Assure supports only one UNI over its two interfaces. 
+						One of the interfaces corresponds to the UNI-N side of the UNI, 
+						while the other interface corresponds to the UNI-C side of the interface.
+						Each side acts on packets only on ingress at each interface";
+			}
+			
+			container uni-c { //aka mefServiceUniCfgEntry
+				presence "If present this configures the UNI-C";
+
+				uses uni-attributes;
+				
+				must "//msea-svcs:mef-services/msea-svcs:uni/msea-svcs:uni-n" {
+					error-app-tag "msea-svcs-must-00";
+					error-message "Both UNI-C and UNI-N must be specified";
+				}
+
+				description "The configuration of the UNI-C side of the UNI.
+						UNI-C refers to eth1 by default but can be changed through the 
+						uni-side-interface-assignment attribute.
+						The interface used must have been configured as a UNI";
+			}
+
+			container uni-n { //aka mefServiceUniCfgEntry
+				presence "If present this configures the UNI-N";
+
+				uses uni-attributes;
+
+				must "//msea-svcs:mef-services/msea-svcs:uni/msea-svcs:uni-c" {
+					error-app-tag "msea-svcs-must-01";
+					error-message "Both UNI-C and UNI-N must be specified";
+				}
+
+				description "The configuration of the UNI-C side of the UNI.
+						UNI-N refers to eth0 by default but can be changed through the 
+						uni-side-interface-assignment attribute.
+						The interface used must have been configured as a UNI";
+			}
+
+			list evc { //aka mefServiceEvcPerUniCfgEntry
+				key evc-index;
+				max-elements 32;
+				description "The UNI can support one or more EVCs";
+				
+				
+				leaf evc-index { //aka mefServiceEvcCfgIndex
+					type uint32 {
+						range 1..max;
+					}
+					description
+					"The specific instance of an EVC number.";
+				}
+		
+				leaf name { //aka mefServiceEvcCfgIdentifier
+					type msea:identifier45;
+					mandatory true;
+					
+					description
+					"This object indicates the EVC identifier. The identifier is
+					an arbitrary text string that is used to identify an EVC.
+					Unique string values are chosen to uniquely identify the EVC.
+		
+					Octet values of 0x00 through 0x1f are illegal.
+		
+					MEF 26.1 restricts the maximum size identifiers to 45 octets.";
+					reference
+					"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+				}
+
+				
+				leaf uni-evc-id { //aka mefServiceEvcCfgIdentifier
+					type msea:identifier45;
+					config false;
+					description
+					"The UNI EVC ID is a string formed by the concatenation of 
+					the UNI ID (Section 9.1) and the EVC ID (Section 8.2) that
+					is used to identify an EVC at the UNI. It is intended for 
+					management and control purposes.";
+					reference
+					"[MEF 10.3] 10.1";
+				}
+				
+				leaf service-type { //aka mefServiceEvcCfgServiceType
+					type enumeration {
+						enum pointToPoint {
+							description "EVC Point-to-Point service,
+							used for EPL and EVPL services"; 
+						}
+						
+						enum multipointToMultipoint {
+							description "EVC Multipoint-to-Multipoint 
+							Service, used for EP-LAN and EVP-LAN
+							services"; 
+						}
+						
+						enum rootedMultipoint {
+							description "EVC Rooted-Multipoint Service,
+							used for EP-Tree and EVP-Tree services"; 
+						}
+						
+					}
+					default pointToPoint;
+//					msea:not-changeable;
+
+					description
+					"This object configures the EVC service type for the ME-NE.";
+
+					reference
+					"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+				}
+
+				leaf mtu-size { //aka mefServiceEvcCfgMtuSize
+					type uint32 {
+						range "9600";
+					}
+					units "octets";
+					default 9600;
+					description
+					"This object indicates the configured EVC maximum service frame format
+					size. It must be less than or equal to the
+					mefServiceEvcStatusMaxMtuSize.";
+					reference
+					"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+				}
+
+				leaf cevlan-id-preservation { //aka mefServiceEvcCfgCevlanIdPreservation
+					type msea:service-preservation-type;
+					default preserve;
+//					msea:not-changeable;
+					
+					description
+					"This object configures the EVC CE-VLAN ID preservation.
+
+					preserve(1) The CE-VLAN ID is preserved. The ingress CE-VLAN
+					is the CE-VLAN ID at the egress UNI
+					noPreserve(2) The CE-VLAN ID is not preserved. The ingress
+					CE-VLAN ID may not be the CE-VLAN ID at the egress
+					UNI";
+					reference
+					"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+				}
+
+				leaf cevlan-cos-preservation { //aka mefServiceEvcCfgCevlanCosPreservation
+					type msea:service-preservation-type;
+					default preserve;
+//					msea:not-changeable;
+
+					description
+					"This object configures EVC CE-VLAN CoS preservation.
+
+					preserve(1) The CE-VLAN CoS is preserved. The ingress CE-VLAN
+					CoS is the CE-VLAN CoS at the egress UNI
+					noPreserve(2) The CE-VLAN CoS is not preserved. The ingress
+					CE-VLAN CoS may not be the CE-VLAN CoS at the
+					egress UNI";
+					reference
+					"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+				}
+
+				container evc-status { //aka mefServiceEvcStatusEntry
+					config false;
+					description
+					"The conceptual row of mefServiceEvcStatusTable.";
+
+					leaf max-mtu-size { //aka mefServiceEvcStatusMaxMtuSize
+						type uint32 {
+							range "1522..16384";
+						}
+						units "octets";
+						description
+						"This object indicates the EVC maximum configurable service
+						frame format size. The actual configured size is set via the
+						mefServiceEvcCfgMtuSize object.";
+						reference
+						"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+					}
+
+					leaf max-num-uni { //aka mefServiceEvcStatusMaxNumUni
+						type uint32 {
+							range "2..16384";
+						}
+						description
+						"This object indicates the maximum number of UNIs in an EVC. For
+						a Point-to-Point EVC this value is '2'. For a Multipoint EVC the
+						value can be '2' or greater.";
+						reference
+						"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+					}
+
+					leaf operational-state { //aka mefServiceEvcStatusOperationalState
+						type entity-state:EntityOperState;
+						description
+						"This object indicates the operational state (current
+						capability) of the EVC.
+
+						If the value is 'enabled', the EVC is able to ingress and
+						egress service frames and has been set to active.
+
+						If the value is 'disabled' the EVC is not able to ingress and
+						egress service frames, has detected an operational failure
+						condition, or has failed an internal test.
+
+						If the value is 'testing' the EVC has been placed into a test mode,
+						either a troubleshooting mode or a test mode.
+
+						If the value is 'unknown' the EVC is unable to report the operational
+						state.";
+						reference
+						"[MEF 7.2] 6.2.1.3";
+					}
+				} //End evc-status
+
+				container evc-per-uni {
+					leaf evc-uni-type { //aka mefServiceEvcUniCfgType
+						type enumeration {
+							enum root {
+								description "Valid setting for all service types. A UNI set
+								to this value may send frames to UNIs configured
+								as 'root' or 'leaf'";
+							}
+						}						
+						default root;
+						description
+						"This object configures UNI type on an EVC.";
+						reference
+						"[MEF 10.2]";
+	
+					}
+					
+					container evc-per-uni-c { //aka mefServiceUniCfgEntry
+	
+						description "The configuration of the UNI-C side of the EVC-per-UNI.";
+						
+						uses evc-per-uni-extension-attributes;
+							
+					} //End evc-per-uni-c
+					
+					
+					container evc-per-uni-n { //aka mefServiceUniCfgEntry
+	
+						description "The configuration of the UNI-N side of the EVC-per-UNI";
+			
+						uses evc-per-uni-extension-attributes;
+							
+					} //End evc-per-uni-n
+				}
+			} //End evc
+		} //end of uni
+		
+		
+	container profiles {
+
+		list bwp-group { //aka mefServiceBwpGrpCfgEntry
+
+			key "group-index";
+			max-elements 64;
+			description
+			"Bandwidth profile group settings table entry.";
+
+			leaf group-index { //aka mefServiceBwpGrpCfgIndex
+				type uint8;
+				description
+				"Bandwidth profile group index number";
+			}
+
+			list bwp { //aka mefServiceBwpCfgEntry
+				key "cos-index";//Changed to cos-index (from bwp-index) based on MEP 40 6.4.2 
+				unique name;
+				max-elements 64;
+				
+				description
+				"Bandwidth profile settings table entry.";
+
+				leaf cos-index { //aka mefServiceBwpCfgCosIndex
+					type leafref {
+						path "/msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos/msea-svcs:cos-index";
+					}
+					description
+					"This object is the index number of the CoS ID profile
+					associated with the current bandwidth profile. A value of 0 indicates
+					that no CoS ID profile is associated with the bandwidth profile and the
+					bandwidth profile applies to all CoS IDs.
+
+					This index indicates a specific CoS ID profile previously configured via
+					mefServiceCosCfgTable as indicated by the mefServiceCosCfgIndex object.";
+					reference
+					"[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+					
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='0']) <= 1" {
+						error-app-tag "msea-svcs-must-02";
+						error-message "Priority 0 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='1']) <= 1" {
+						error-app-tag "msea-svcs-must-03";
+						error-message "Priority 1 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='2']) <= 1" {
+						error-app-tag "msea-svcs-must-04";
+						error-message "Priority 2 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='3']) <= 1" {
+						error-app-tag "msea-svcs-must-05";
+						error-message "Priority 3 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='4']) <= 1" {
+						error-app-tag "msea-svcs-must-06";
+						error-message "Priority 4 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='5']) <= 1" {
+						error-app-tag "msea-svcs-must-07";
+						error-message "Priority 5 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='6']) <= 1" {
+						error-app-tag "msea-svcs-must-08";
+						error-message "Priority 6 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:*/priority[.='7']) <= 1" {
+						error-app-tag "msea-svcs-must-09";
+						error-message "Priority 7 can be specified only once in the COS's related to a BWP Group";
+					}
+
+					
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:evc-cos-type-all-8-prio-to-1-evc-color) <= 1" {
+						error-app-tag "msea-svcs-must-10";
+						error-message "Only one COS can be specified in a Bandwidth Profile Group when the cos-type is 'evc-cos-type-all-8-prio-to-1-evc-color' ";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:evc-cos-type-all-8-prio-to-1-pcp-color) <= 1" {
+						error-app-tag "msea-svcs-must-11";
+						error-message "Only one COS can be specified in a Bandwidth Profile Group when the cos-type is 'evc-cos-type-all-8-prio-to-1-pcp-color' ";
+					}
+
+					must "count(//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:cos[msea-svcs:cos-index=//msea-svcs:mef-services/msea-svcs:profiles/msea-svcs:bwp-group[msea-svcs:group-index=current()/../../msea-svcs:group-index]/msea-svcs:bwp/msea-svcs:cos-index]/msea-svcs:evc-cos-type-all-8-prio-to-1-dei-color) <= 1" {
+						error-app-tag "msea-svcs-must-12";
+						error-message "Only one COS can be specified in a Bandwidth Profile Group when the cos-type is 'evc-cos-type-all-8-prio-to-1-dei-color' ";
+					}
+
+					must "current()/../../msea-svcs:group-index > 0" {
+						error-app-tag "msea-svcs-must-15";
+						error-message "No BWP's can be added to the Bandwidth Profile Group 0, as this index represents a special case";
+					}
+				}
+
+				leaf name { //mefServiceBwpCfgIdentifier
+					type string {
+						length "1..45";
+					}
+					mandatory true;
+					description
+					"This object indicates the bandwidth profile identifier for the
+					associated bandwidth profile index and is an arbitrary
+					text string that is used to identify a bandwidth profile. Unique
+					string values are chosen to uniquely identify the bandwidth
+					profile.
+
+					Octet values of 0x00 through 0x1f are illegal.
+
+					MEF 26.1 restricts the maximum size identifiers to 45 octets.";
+					reference
+					"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+				}
+
+				leaf committed-information-rate { //aka mefServiceBwpCfgCir
+					type uint32 {
+						range "0..10000000";
+					}
+					units "kbits/s";
+					default 1000000;
+//					msea:not-changeable;
+					
+					description
+					"This object indicates the Committed Information Rate (CIR) in kbits/s
+					and defines the average rate in kbits/sec up to which
+					the network delivers Service Frames. Service Frames that meet
+					the CIR are said to be in profile or in conformance to performance
+					objectives. These frames are generally identified as 'Green' 
+					Service Frames.";
+					reference
+					"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+				}
+
+				leaf committed-burst-size { //aka mefServiceBwpCfgCbs
+					type uint32 {
+						range "0..10000000";
+					}
+					units "bytes";
+					default 12;
+//					msea:not-changeable;
+
+					description
+					"This object indicates the Committed Burst Size (CBS) in bytes. It limits
+					the maximum number of bytes available for a burst of Service Frames sent
+					at interface speed to remain CIR-conformant.";
+					reference
+					"[MEF 10.2]";
+				}
+
+				leaf excess-information-rate { //aka mefServiceBwpCfgEir
+					type uint32 {
+						range "0..10000000";
+					}
+					units "kbits/s";
+//					msea:not-changeable;
+
+					description
+					"This object indicates the Excess Information Rate (EIR) in kbits/s
+					and defines the average rate in kbits/sec of Service Frames up to
+					which the network may deliver Service Frames but without performance
+					objectives. Service Frames that meet the EIR as set to be in out-of-
+					profile or not in conformance to performance objectives. These
+					frames are not guaranteed to be delivered and are generally identified
+					as 'Yellow' service frames.";
+					reference
+					"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+				}
+
+				leaf excess-burst-size { //aka mefServiceBwpCfgEbs
+					type uint32 {
+						range "0..10000000";
+					}
+					units "bytes";
+//					msea:not-changeable;
+
+					description
+					"This object indicates the Excess Burst Size (EBS) in bytes. It limits
+					the maximum number of bytes available for a burst of Service Frames
+					sent at the interface speed to remain EIR-conformant.";
+					reference
+					"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+				}
+
+				leaf color-mode { //aka mefServiceBwpCfgCm
+					type enumeration {
+						enum colorBlind {description "A bandwidth profile property where ingress 
+							Service Frames are not pre-colored for either
+							green or yellow, and if present, is ignored when
+							determining the level of compliance for each
+							Service Frame";
+						}
+						
+						enum colorAware {
+							description "A bandwidth profile property were a pre-determined
+							level of Bandwidth Profile compliance for each
+							Service Frame is taken into account when determining
+							the level of compliance for each Service Frame.
+							Each service frame can be colored red (discarded),
+							yellow (conditional delivery), or green (unconditional
+							delivery.";
+						}
+					}
+					default colorBlind;
+//					msea:not-changeable;
+
+					description
+					"This object configures the bandwidth profile color mode.";
+
+					reference
+					"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+				}
+
+				leaf coupling-flag { //aka mefServiceBwpCfgCf
+					type enumeration {
+						enum couplingYellowEirOnly {
+							description "The long term average bit rate of Service
+							Frames that are declared Yellow is bounded by EIR."; 
+						}
+
+						enum couplingYellowEirPlusCir {
+							description "The long term average bit rate of Service
+							Frames that are declared Yellow is bounded
+							by CIR + EIR depending on the volume of
+							the offered Service Frames that are
+							declared Green.";
+						}
+					}
+					
+					default couplingYellowEirOnly;
+//					msea:not-changeable;
+
+					description
+					"This object configures the bandwidth profile coupling flag and has
+					the effect of controlling the volume of the Service Frames that are
+					declared Yellow.";
+
+					reference
+					"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+				}
+
+			} //End bwp
+
+		} //End bwp-group
+
+		list cos { //aka mefServiceCosCfgEntry
+			key "cos-index";
+			unique name;
+			max-elements 64;
+			description
+			"Class of Service Identifier settings table entry.";
+
+			leaf cos-index { //aka mefServiceCosCfgIndex
+				type uint32 {
+					range 1..max;
+				}
+				description
+				"Class of Service Identifier profile index number.";
+			}
+
+			leaf name { //aka mefServiceCosCfgIdentifier
+				type string {
+					length 1..45;
+				}
+				
+				description
+				"This object indicates the Class of Service Name for the
+				associated CoS profile index and is an arbitrary text string that is
+				used to identify a CoS ID profile. Unique string values are chosen to
+				uniquely identify the profile.
+
+				Octet values of 0x00 through 0x1f are illegal.
+
+				MEF 26.1 restricts the maximum size identifiers to 45 octets.";
+				reference
+				"[MEF 6.1] 6.0, 6.1, 6.2, 6.3; [MEF 7.2] 6.2.1.2, 6.2.1.3";
+			}
+			
+			choice cos-type-choice {
+				description "CoS configuration alternatives.";
+				//We have 6 choices in a single tier choice structure which is easier for client
+				//tools to represent automatically rather than a two tier choice structure
+				
+				case evc-cos-type-evc-color-id {
+					container evc-cos-type-all-8-prio-to-1-evc-color {
+						description "Indicates that the CoS profile is associated
+						with the virtual channel, i.e. EVC or OVC. All 8 priorities
+						are mapped to the outgoing-cos-value - therefore there can 
+						only be one of this type of COS specified in any BWP Group";
+								
+						leaf evc-all-8-color-to {
+							description "The color to be applied regardless of priority";
+							mandatory true;
+							type msea:cos-color-type;
+						}
+					}							
+				}
+				
+				case evc-cos-type-pcp-color-id {
+				
+					container evc-cos-type-all-8-prio-to-1-pcp-color {
+						description "Indicates that the CoS profile is associated
+						with the virtual channel, i.e. EVC or OVC. All 8 priorities
+						are mapped to the outgoing-cos-value - therefore there can 
+						only be one of this type of COS specified in any BWP Group";
+
+						list pcp-color-per-prio {
+							key pcp-id;
+							description "The PCP value of the incoming frame is 
+							used to lookup the following table to determine the 
+							frame's color";
+
+							min-elements 8;
+							max-elements 8;
+							uses pcp-color-map-grouping;
+						}
+					}
+				}
+							
+				case evc-cos-type-dei-color-id {
+					container evc-cos-type-all-8-prio-to-1-dei-color {
+						presence "Cos type EVC and Color Mapping DEI";
+						
+						description "Indicates that the CoS profile is associated
+						with the virtual channel, i.e. EVC or OVC. All 8 priorities
+						are mapped to the outgoing-cos-value - therefore there can 
+						only be one of this type of COS specified in any BWP Group
+						The source of the color is DEI of the
+						incoming frame. False (0) in the DEI field will set 
+						the color to Green and True (1) will set to Yellow";
+
+					}
+				}
+					
+				case pcp-cos-type-evc-color-id {
+					container pcp-cos-type-n-prio-to-1-evc-color {
+						description "Indicates that the CoS profile is associated
+							with the incoming frame's Priority Code Point (priority bits).";
+							
+						leaf-list priority {
+							type msea:priority-type;
+							ordered-by system;
+							
+							description "A list of priorities that apply to this COS.
+							When the COS type is PCP a subset of the priorities can 
+							be specified. Other priorities can be specified in 
+							additional COS profiles. In total the same priority
+							cannot be repeated in a BWP Group";
+
+							min-elements 1;
+							max-elements 8;
+						}
+						
+						leaf evc-all-8-colors-to {
+							description "The color to be applied regardless 
+							of priority. If multiple instances of this cos
+							type have different values then the color-type
+							of the last one will apply";
+
+							type msea:cos-color-type;
+							mandatory true;
+						}
+					}
+				}
+							
+				case pcp-cos-type-pcp-color-id {
+					container pcp-cos-type-n-prio-to-1-pcp-color {
+						description "Indicates that the CoS profile is associated
+							with the incoming frame's Priority Code Point (priority bits). 
+							The PCP value of the incoming frame is used to lookup the 
+							follwing table to determine the frame's color";
+							
+						leaf-list priority {
+							type msea:priority-type;
+							min-elements 1;
+							max-elements 8;
+							ordered-by system;
+
+							description "A list of priorities that apply to this COS.
+							When the COS type is PCP a subset of the priorities can 
+							be specified. Other priorities can be specified in 
+							additional COS profiles. In total the same priority
+							cannot be repeated in a BWP Group";
+						}
+						
+						list pcp-color-for-prio {
+							key pcp-id;
+							description "Each priority specified above must
+							have a corresponding color otherwise the default 
+							(green) will apply";
+
+							min-elements 1;
+							ordered-by system;
+
+							uses pcp-color-map-grouping {
+								refine pcp-id {
+									must "count(current()/../../msea-svcs:priority[.=current()]) = 1" {
+										error-message "Each element must already exist in the priority list";
+									}
+								}
+							}
+						}
+					}
+				}
+							
+
+				case pcp-cos-type-dei-color-id {
+					container pcp-cos-type-n-prio-to-1-dei-color {
+						description "Indicates that the CoS profile is associated
+							with the incoming frame's Priority Code Point (priority bits). 
+							The DEI value of the incoming frame is used to determine 
+							the frame's color. False (0) in the DEI field of the frame 
+							will set the color to Green and True (1) will set to Yellow";
+							
+						leaf-list priority {
+							type msea:priority-type;
+							min-elements 1;
+							max-elements 8;
+							ordered-by system;
+							
+							description "A list of priorities that apply to this COS.
+							When the COS type is PCP a subset of the priorities can 
+							be specified. Other priorities can be specified in 
+							additional COS profiles. In total the same priority
+							cannot be repeated in a BWP Group";
+						}
+					}
+				}
+				
+				mandatory true;
+//				msea:not-changeable;
+			}
+		    
+			leaf outgoing-cos-value {
+			  type msea:priority-type;
+			  mandatory true;
+//			  msea:not-changeable;
+
+		      description
+		        "Used to set the egress COS to use for all ingress COS explicitly listed";
+		      reference   
+				 "Edge Assure internal API";
+		    }
+
+			leaf color-aware {
+			  type boolean;
+			  mandatory true;
+//			  msea:not-changeable;
+
+			  description
+			    "Set if the profile should be treated as colour aware (true) or not (false)";
+		      reference   
+				 "Edge Assure internal API";
+			}
+			
+			leaf color-forward {
+			  type boolean;
+			  mandatory true;
+//			  msea:not-changeable;
+
+			  description
+			    "Used to override the colour mapping of the profile. If true the ingress colour is forwarded";
+		      reference   
+				 "Edge Assure internal API";
+			}
+
+		} //End cos
+		
+	      
+    } //End of profiles
+
+	} //End of mef-services
+
+} /* end of module msea-uni-evc-service */
\ No newline at end of file