Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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;
        }
        public void ServiceConfig_ValidValueValidation2()
        {
            Startup.LoadSettings();

            var key = new ServiceKey()
            {
                Id            = 195,
                EffectiveDate = DateTime.Now
            };

            key.AddValue("GPID", "12345", AttributeType.Integer);
            key.AddValue("PCATProductID", "551", AttributeType.Integer);

            key.AddValue("sslWinHostChkTiering", "Yes", AttributeType.List);
            key.AddValue("SSLClntQty", "0", AttributeType.Integer);

            var sc       = ServiceConfiguration.Get(key.Id, key.EffectiveDate);
            var response = sc.Validate(key);

            // sslWinHostChkTiering should be no error
            Assert.IsFalse(response.IsValid);
        }
Пример #6
0
        public void Get()
        {
            Startup.LoadSettings();
            // test assumes service 212 has child of 213 named "test"

            var key = new ServiceKey();

            key.Id            = 212;
            key.EffectiveDate = DateTime.Now;
            key.AddValue("ValueTest", "8", PCAT.Common.Models.Attribute.AttributeType.Integer);

            var sh = ServiceHierarchy.Get(key);

            Assert.IsTrue(sh.Count > 0);
            Assert.AreEqual(sh[0].Name, "test");
        }
        public void ServiceConfig_ValidValueValidation()
        {
            Startup.LoadSettings();

            var key = new ServiceKey()
            {
                Id            = 215,
                EffectiveDate = DateTime.Now
            };

            key.AddValue("GPID", "12345", AttributeType.Integer);
            key.AddValue("PCATProductID", "551", AttributeType.Integer);
            key.AddValue("IPv4 eBGP Remote Peer ASN", "1234", AttributeType.Integer);
            key.AddValue("Ipv4 eBGP Remote Peer ASN", "blah", AttributeType.List);
            key.AddValue("Public ASN Validation", "blah", AttributeType.SimpleText);
            key.AddValue("Authentication Required", "Yes", AttributeType.List);
            key.AddValue("IPv4 Authentication Key", "Yes", AttributeType.SimpleText);

            var sc       = ServiceConfiguration.Get(key.Id, key.EffectiveDate);
            var response = sc.Validate(key);

            // eBGP Remote Peer ASN Type can't be blah
            Assert.IsFalse(response.IsValid);
        }