Example #1
0
        public void ChildAttributeTest()
        {
            Startup.LoadSettings();
            // test requirements
            //      service 219
            //         has Attribute with default rule on Child[MULTIPLE COS SERVICE].
            //          has MULTIPLE COS SERVICE child relationship in Service Hierarchy

            var key = new ServiceKey();

            key.Id            = 219;
            key.EffectiveDate = DateTime.Now;
            key.AddValue("CoS Allocation Type", "Multiple COS", PCAT.Common.Models.Attribute.AttributeType.List);
            key.Children = new Dictionary <string, List <ServiceKey> >();

            var child = new ServiceKey()
            {
                Id            = 228,
                EffectiveDate = DateTime.Now
            };

            child.AddValue("Test Attribute", "6", AttributeType.SimpleText);
            key.Children.Add("MULTIPLE COS SERVICE", new List <ServiceKey>()
            {
                child
            });

            var results = ServiceAttributes.Get(key, true);
        }
Example #2
0
        public void ParentAttributeTest()
        {
            Startup.LoadSettings();
            // test requirements
            //      service 215
            //          inherits from 300 with parent attributes GPID and PCATProductID

            var key = new ServiceKey();

            key.Id            = 215;
            key.EffectiveDate = DateTime.Now;
            key.AddValue("ValueTest", "8", PCAT.Common.Models.Attribute.AttributeType.Integer);
            key.Relationships = new Dictionary <string, List <ServiceKey> >();

            var parent = new ServiceKey()
            {
                Id            = 212,
                EffectiveDate = DateTime.Now
            };

            parent.AddValue("GPID", "12345", AttributeType.Integer);
            parent.AddValue("PCATProductID", "444", AttributeType.Integer);
            key.ParentServiceKey = parent;

            var results = ServiceAttributes.Get(key, true);
        }
Example #3
0
        public void RelatedAttributeTest()
        {
            Startup.LoadSettings();
            // test requirements
            //      service 215
            //          has EBGP Remote Peer ASN attribute of type Relationship, with default rule on Relationship[IPVPN]
            //          has IPVPN relationship

            var key = new ServiceKey();

            key.Id            = 215;
            key.EffectiveDate = DateTime.Now;
            key.AddValue("ValueTest", "8", PCAT.Common.Models.Attribute.AttributeType.Integer);
            key.Relationships = new Dictionary <string, List <ServiceKey> >();

            var ipvpn = new ServiceKey()
            {
                Id            = 217,
                EffectiveDate = DateTime.Now
            };

            ipvpn.AddValue("eBGP Remote Peer ASN", "65123", AttributeType.Integer);
            key.Relationships.Add("IPVPN", new List <ServiceKey>()
            {
                ipvpn
            });

            var results = ServiceAttributes.Get(key, true);
            //int x = 1;
        }
Example #4
0
        public void ReadOnlyRuleAttributeTest()
        {
            Startup.LoadSettings();
            // test requirements
            //      service 215
            //          inherits from 300 with parent attributes GPID and PCATProductID

            var key = new ServiceKey();

            key.Id            = 234;
            key.EffectiveDate = DateTime.Now;

            var parent = new ServiceKey()
            {
                Id            = 217,
                EffectiveDate = DateTime.Now
            };

            parent.AddValue("GPID", "12345", AttributeType.Integer);
            parent.AddValue("PCATProductID", "551", AttributeType.Integer);
            parent.AddValue("Netflow Data Collection to Customer", "Yes", AttributeType.List);
            key.ParentServiceKey = parent;
            var results = ServiceAttributes.Get(key, true);

            Assert.IsFalse(results.First(a => a.Name.Equals("Port")).ReadOnly);

            parent.AddValue("Netflow Data Collection to Customer", "No", AttributeType.List);
            results = ServiceAttributes.Get(key, true);
            Assert.IsTrue(results.First(a => a.Name.Equals("Netflow Data Collection to Customer")).ReadOnly);
        }
Example #5
0
 public ObjectResult ImpactAttributes(ImpactedServiceKeyWeb postData)
 {
     return(WebFunction.Execute <ImpactedServiceKeyWeb, ImpactAttributes>(this, postData, (k) =>
     {
         var key = new ServiceKey(k.Key);
         var impactAttributes = ServiceAttributes.GetImpactAttributes(key, k.ChangedAttributes);
         return new WebResult <ImpactAttributes>(impactAttributes);
     }));
 }
Example #6
0
        public ObjectResult Attributes(ServiceAttributesKeyWeb postData)
        {
            return(WebFunction.Execute <ServiceAttributesKeyWeb, AttributeInfoWeb[]>(this, postData, (sa) =>
            {
                AttributeInfoWeb[] list;

                if (sa == null)
                {
                    list = new AttributeInfoWeb[1];
                    list[0] = new AttributeInfoWeb {
                        ErrorString = "Key cannot be null", IsValid = false
                    };

                    return new WebResult <AttributeInfoWeb[]>(list);
                }
                var sKey = new ServiceKey(sa);
                try
                {
                    var atts = ServiceAttributes.Get(sKey, sa.PopulateLists);
                    list = new AttributeInfoWeb[atts.Count];
                    var i = 0;
                    foreach (var att in atts)
                    {
                        list[i++] = new AttributeInfoWeb(att);
                    }
                }
                catch (Exception e)
                {
                    list = new AttributeInfoWeb[1];
                    list[0] = new AttributeInfoWeb {
                        ErrorString = e.Message, IsValid = false
                    };
                }

                return new WebResult <AttributeInfoWeb[]>(list);
            }));
        }