public void ServiceImpactedChildren() { //Assumes that service 217 has an active relationship Startup.LoadSettings(); var Impact = new ImpactedServiceKeyWeb(); var key = new ServiceKeyWeb(); key.ServiceID = 217; key.Date = DateTime.Now; key.Attributes = new AttributeInstanceWeb[1]; key.ChildServices = new ServiceNamedCollectionWeb[0]; key.IsValid = true; var attr = new AttributeInstanceWeb(); attr.Name = "CoS Allocation Type"; attr.Type = "Text"; var value = new AttributeChoiceWeb(); value.Value = "Multiple COS"; attr.Value = value; key.Attributes[0] = attr; Impact.Key = key; Impact.ChangedAttributes = new List <string> { "Peak Information Rate", "eBGP Remote Peer ASN" }; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceImpactedChildren; var Imp = ApiClient.Post <List <long>, ImpactedServiceKeyWeb> (HttpTargetType.FSCMediation, "FSC Mediation Service Impacted children", url, Impact, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(Imp); Assert.IsTrue(Imp.Count > 0); }
public void ServiceBuildChild() { //Assumes that service Id 227 has children tha are available when product id is 570 Startup.LoadSettings(); var key = new BuildChildServiceRequestWeb(); var parent = new ServiceKeyWeb(); parent.ServiceID = 227; parent.Date = DateTime.Now; parent.Attributes = new AttributeInstanceWeb[1]; var attr = new AttributeInstanceWeb(); attr.Name = "PCATProductID"; attr.Type = "Text"; var value = new AttributeChoiceWeb(); value.Value = "570"; attr.Value = value; parent.Attributes[0] = attr; parent.ChildServices = new ServiceNamedCollectionWeb[0]; parent.IsValid = true; key.ParentService = parent; key.Name = "LAN PORT SERVICE"; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceBuildChild; var hierarchy = ApiClient.Post <ServiceKeyWeb, BuildChildServiceRequestWeb> (HttpTargetType.FSCMediation, "FSC Mediation Serv Build child", url, key, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(hierarchy); Assert.IsTrue(hierarchy.Attributes.Length > 0); }
public static OffnetAttrInstanceWeb FromString(string attributeInstanceString) { OffnetAttrInstanceWeb attributeInstance = null; if (attributeInstanceString.StartsWith("AttributeInstance: ")) { attributeInstance = new OffnetAttrInstanceWeb(); // remove (address) from glm id int open = attributeInstanceString.IndexOf("@#("); int equal = attributeInstanceString.IndexOf('='); if (open > 0 && open < equal) { attributeInstance.Name = attributeInstanceString.Substring(19, open - 19); attributeInstance.Type = attributeInstanceString.Substring(open + 3, attributeInstanceString.IndexOf(')', open) - open - 3); } else { attributeInstance.Name = attributeInstanceString.Substring(19, equal - 20); } string value = "null"; if (attributeInstanceString.Length > equal + 2) { value = attributeInstanceString.Substring(equal + 2); } if (value.Equals("null")) { attributeInstance.Value = null; } else { attributeInstance.Value = AttributeChoiceWeb.FromString(value); } } return(attributeInstance); }
public OffnetAttrInstanceWeb(string name, string value, string display, AttributeType type) { Name = name; Type = (type == null) ? "Unknown" : type.ToString(); Value = new AttributeChoiceWeb(value, display); }