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 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 ObjectResult Children(ServiceKeyWeb postData) { return(WebFunction.Execute <ServiceKeyWeb, List <ServiceChildWeb> >(this, postData, (sv) => { var key = new ServiceKey(sv); var children = ServiceHierarchy.Get(key); return new WebResult <List <ServiceChildWeb> >(children.Select(c => c.ToWeb()).ToList()); })); }
public ObjectResult Relationships(ServiceKeyWeb postData) { return(WebFunction.Execute <ServiceKeyWeb, ServiceRelationshipWeb[]>(this, postData, (sv) => { var key = new ServiceKey(sv); var config = ServiceRelationships.Get(key); var svcRel = config.Select(def => def.GetDefinition(key)).Where(pd => pd != null).ToList(); var answer = svcRel.Select(rel => rel.ToWeb()).ToArray(); return new WebResult <ServiceRelationshipWeb[]>(answer); })); }
public void ServiceValidate() { //Assumes that service 217 has no impacts Startup.LoadSettings(); var key = new ServiceKeyWeb(); key.ServiceID = 185; key.Date = DateTime.Now; key.Attributes = new AttributeInstanceWeb[5]; key.Attributes[0] = new AttributeInstanceWeb { Name = "activity", Value = new AttributeChoiceWeb { Value = "None" } }; key.Attributes[1] = new AttributeInstanceWeb { Name = "PCATProductID", Type = "Text", Value = new AttributeChoiceWeb { Value = "471", DisplayValue = "471" }, }; key.Attributes[2] = new AttributeInstanceWeb { Name = "GPID", Type = "Text", Value = new AttributeChoiceWeb { Value = "220152096", DisplayValue = "220152096" } }; key.Attributes[2] = new AttributeInstanceWeb { Name = "name", Type = "Text", Value = new AttributeChoiceWeb { Value = "ANS Shared VPN", DisplayValue = "ANS Shared VPN" } }; key.ChildServices = new ServiceNamedCollectionWeb[0]; key.IsValid = true; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceValidate; var val = ApiClient.Post <ValidateServiceResponseWeb, ServiceKeyWeb> (HttpTargetType.FSCMediation, "FSC Mediation Service Impacts", url, key, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(val); Assert.IsFalse(val.IsValid); }
public ObjectResult Validate(ServiceKeyWeb postData) { return(WebFunction.Execute <ServiceKeyWeb, ValidateServiceResponseWeb>(this, postData, (sv) => { var key = new ServiceKey(sv); var config = ServiceConfiguration.Get(key.Id, key.EffectiveDate); ValidateServiceResponse answer = config.Validate(key); return new WebResult <ValidateServiceResponseWeb>(new ValidateServiceResponseWeb(answer)); }, (ex) => { return new WebResult <ValidateServiceResponseWeb>(new ValidateServiceResponseWeb(ex)); })); }
public void ServiceRelationships() { //Assumes that service 217 has an no active relationships Startup.LoadSettings(); var key = new ServiceKeyWeb(); key.ServiceID = 217; key.Date = DateTime.Now; key.Attributes = new AttributeInstanceWeb[0]; key.ChildServices = new ServiceNamedCollectionWeb[0]; key.IsValid = true; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceRelationships; var relations = ApiClient.Post <ServiceRelationshipWeb[], ServiceKeyWeb> (HttpTargetType.FSCMediation, "FSC Mediation Service Realtionships", url, key, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(relations); Assert.IsTrue(relations.Length == 0); }
public void ServiceChildren() { //Assumes that service 217 has children Startup.LoadSettings(); var key = new ServiceKeyWeb(); key.ServiceID = 217; key.Date = DateTime.Now; key.Attributes = new AttributeInstanceWeb[0]; key.ChildServices = new ServiceNamedCollectionWeb[0]; key.IsValid = true; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceChildren; var children = ApiClient.Post <List <ServiceChildWeb>, ServiceKeyWeb> (HttpTargetType.FSCMediation, "FSC Mediation Service children", url, key, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(children); Assert.IsTrue(children.Count > 0); }
public void ServiceImpacts() { //Assumes that service 217 has no impacts Startup.LoadSettings(); var Impact = new ImpactedServiceKeyWeb(); var key = new ServiceKeyWeb(); key.ServiceID = 217; key.Date = DateTime.Now; key.Attributes = new AttributeInstanceWeb[0]; key.ChildServices = new ServiceNamedCollectionWeb[0]; key.IsValid = true; Impact.Key = key; Impact.ChangedAttributes = new List <string> { "Peak Information Rate", "eBGP Remote Peer ASN" }; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceImpacts; var Imp = ApiClient.Post <ImpactAttributes, ImpactedServiceKeyWeb> (HttpTargetType.FSCMediation, "FSC Mediation Service Impacts", url, Impact, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(Imp); Assert.IsTrue(Imp.Impacts.Count == 0); }