From d25acfeff21e953aaf1a49c634bc9059a4b38119 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Wed, 16 Nov 2016 09:29:34 -0700 Subject: [PATCH 01/38] updated from master and added id sorting --- traffic_ops/app/lib/Fixtures/Cachegroup.pm | 18 +- traffic_ops/app/lib/Fixtures/Cdn.pm | 4 +- .../app/lib/Fixtures/Deliveryservice.pm | 17 +- .../app/lib/Fixtures/DeliveryserviceServer.pm | 2 +- traffic_ops/app/lib/Fixtures/Parameter.pm | 478 ++--- traffic_ops/app/lib/Fixtures/Profile.pm | 42 +- .../app/lib/Fixtures/ProfileParameter.pm | 1664 ++++++++--------- traffic_ops/app/lib/Fixtures/Region.pm | 4 +- traffic_ops/app/lib/Fixtures/Role.pm | 58 +- traffic_ops/app/lib/Fixtures/Server.pm | 387 ++-- traffic_ops/app/lib/Fixtures/Status.pm | 56 +- traffic_ops/app/lib/Fixtures/Type.pm | 2 +- 12 files changed, 1424 insertions(+), 1308 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Cachegroup.pm b/traffic_ops/app/lib/Fixtures/Cachegroup.pm index aeaea02b80..28f8e1f057 100644 --- a/traffic_ops/app/lib/Fixtures/Cachegroup.pm +++ b/traffic_ops/app/lib/Fixtures/Cachegroup.pm @@ -25,8 +25,8 @@ my %definition_for = ( name => 'mid-northeast-group', short_name => 'ne', type => 18, - latitude => 120, - longitude => 120, + latitude => 98.0, + longitude => 98.0, parent_cachegroup_id => undef, }, }, @@ -37,8 +37,8 @@ my %definition_for = ( name => 'mid-northwest-group', short_name => 'nw', type => 18, - latitude => 100, - longitude => 100, + latitude => 98.0, + longitude => 98.0, parent_cachegroup_id => 1, }, }, @@ -49,8 +49,8 @@ my %definition_for = ( name => 'mid_cg3', short_name => 'mid_cg3', type => 6, - latitude => 100, - longitude => 100, + latitude => 98.0, + longitude => 98.0, parent_cachegroup_id => undef, }, }, @@ -61,8 +61,8 @@ my %definition_for = ( name => 'edge_cg4', short_name => 'edge_cg4', type => 5, - latitude => 100, - longitude => 100, + latitude => 98.0, + longitude => 98.0, parent_cachegroup_id => 8, }, }, @@ -76,7 +76,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } # sub all_fixture_names { diff --git a/traffic_ops/app/lib/Fixtures/Cdn.pm b/traffic_ops/app/lib/Fixtures/Cdn.pm index c5f2acc50b..61223d51e5 100644 --- a/traffic_ops/app/lib/Fixtures/Cdn.pm +++ b/traffic_ops/app/lib/Fixtures/Cdn.pm @@ -41,8 +41,8 @@ sub get_definition { } sub all_fixture_names { - # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + # sort by db id to guarantee insert order + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm index 5e11904995..37b56992a0 100644 --- a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm +++ b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm @@ -23,6 +23,7 @@ my %definition_for = ( steering_ds1 => { new => 'Deliveryservice', using => { + id => 1, xml_id => 'steering-ds1', active => 1, dscp => 40, @@ -59,6 +60,7 @@ my %definition_for = ( steering_ds2 => { new => 'Deliveryservice', using => { + id => 2, xml_id => 'steering-ds2', active => 1, dscp => 40, @@ -95,6 +97,7 @@ my %definition_for = ( new_steering => { new => 'Deliveryservice', using => { + id => 3, xml_id => 'steering-ds3', active => 1, dscp => 40, @@ -131,6 +134,7 @@ my %definition_for = ( target_ds1 => { new => 'Deliveryservice', using => { + id => 4, xml_id => 'steering-target-ds1', active => 1, dscp => 40, @@ -167,6 +171,7 @@ my %definition_for = ( target_ds2 => { new => 'Deliveryservice', using => { + id => 5, xml_id => 'steering-target-ds2', active => 1, dscp => 40, @@ -203,6 +208,7 @@ my %definition_for = ( target_ds3 => { new => 'Deliveryservice', using => { + id => 6, xml_id => 'steering-target-ds3', active => 1, dscp => 40, @@ -239,6 +245,7 @@ my %definition_for = ( target_ds4 => { new => 'Deliveryservice', using => { + id => 7, xml_id => 'steering-target-ds4', active => 1, dscp => 40, @@ -275,6 +282,7 @@ my %definition_for = ( ds_cdn1 => { new => 'Deliveryservice', using => { + id => 8, xml_id => 'test-ds1', active => 1, dscp => 40, @@ -313,6 +321,7 @@ my %definition_for = ( ds_cdn2 => { new => 'Deliveryservice', using => { + id => 9, xml_id => 'test-ds2', active => 1, dscp => 40, @@ -351,6 +360,7 @@ my %definition_for = ( ds_cdn3 => { new => 'Deliveryservice', using => { + id => 10, xml_id => 'test-ds3', active => 1, dscp => 40, @@ -389,6 +399,7 @@ my %definition_for = ( ds_cdn4 => { new => 'Deliveryservice', using => { + id => 11, xml_id => 'test-ds4', active => 1, dscp => 40, @@ -426,7 +437,7 @@ my %definition_for = ( ds_dns => { new => 'Deliveryservice', using => { - id => 5, + id => 12, xml_id => 'test-ds5', active => 1, dscp => 40, @@ -464,7 +475,7 @@ my %definition_for = ( ds_http_no_cache => { new => 'Deliveryservice', using => { - id => 6, + id => 13, xml_id => 'test-ds6', active => 1, dscp => 40, @@ -508,7 +519,7 @@ sub get_definition { sub all_fixture_names { # sort by db xml_id to guarantee insertion order - return (sort { $definition_for{$a}{using}{xml_id} cmp $definition_for{$b}{using}{xml_id} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm index 15b148996a..3266e35c86 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm @@ -57,7 +57,7 @@ my %definition_for = ( new => 'DeliveryserviceServer', using => { deliveryservice => 5, - server => 14, + server => 12, }, }, test_ds5_server_edge15 => { diff --git a/traffic_ops/app/lib/Fixtures/Parameter.pm b/traffic_ops/app/lib/Fixtures/Parameter.pm index 202a8c4cc0..3a07cb61b5 100644 --- a/traffic_ops/app/lib/Fixtures/Parameter.pm +++ b/traffic_ops/app/lib/Fixtures/Parameter.pm @@ -19,565 +19,565 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - ## id => 1 - 'allow_ip' => { - new => 'Parameter', - using => { - name => 'allow_ip', - config_file => 'astats.config', - value => '127.0.0.1,172.39.0.0/16,33.101.99.0/24', - }, - }, - ## id => 2 - 'allow_ip6' => { - new => 'Parameter', - using => { - name => 'allow_ip6', - config_file => 'astats.config', - value => '::1,2033:D011:3300::336/64,2033:D011:3300::335/64,2033:D021:3300::333/64,2033:D021:3300::334/64', - }, - }, - ## id => 3 - 'astats_over_http.so' => { - new => 'Parameter', - using => { - name => 'astats_over_http.so', - config_file => 'plugin.config', - value => '_astats 33.101.99.100,172.39.19.39,172.39.19.49,172.39.19.49,172.39.29.49', - }, - }, - ## id => 4 - 'CONFIG-proxy.config.allocator.debug_filter' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.allocator.debug_filter', - config_file => 'records.config', - value => 'INT 0', - }, - }, - ## id => 5 - 'CONFIG-proxy.config.allocator.enable_reclaim' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.allocator.enable_reclaim', - config_file => 'records.config', - value => 'INT 0', - }, - }, - ## id => 6 - 'CONFIG-proxy.config.allocator.max_overage' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.allocator.max_overage', - config_file => 'records.config', - value => 'INT 3', - }, - }, - ## id => 7 - 'CONFIG-proxy.config.cache.control.filename' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.cache.control.filename', - config_file => 'records.config', - value => 'STRING cache.config', - }, - }, - ## id => 8 - 'CONFIG-proxy.config.diags.show_location' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.diags.show_location', - config_file => 'records.config', - value => 'INT 0', - }, - }, - ## id => 9 - 'CONFIG-proxy.config.http.cache.allow_empty_doc' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.http.cache.allow_empty_doc', - config_file => 'records.config', - value => 'INT 0', - }, - }, - ## id => 10 - 'CONFIG-proxy.config.http.parent_proxy.file' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.http.parent_proxy.file', - config_file => 'records.config', - value => 'STRING parent.config', - }, - }, - ## id => 11 - 'CONFIG-proxy.config.hostdb.storage_size' => { - new => 'Parameter', - using => { - name => 'CONFIG proxy.config.hostdb.storage_size', - config_file => 'records.config', - value => 'INT 33554432', - }, - }, - ## id => 12 - 'Disk_Volume' => { - new => 'Parameter', - using => { - name => 'Disk_Volume', - config_file => 'storage.config', - value => '1', - }, - }, - ## id => 13 domain_name => { new => 'Parameter', using => { + id => 3, name => 'domain_name', value => 'foo.com', config_file => 'CRConfig.json', }, }, - ## id => 14 - 'Drive_Letters' => { - new => 'Parameter', - using => { - name => 'Drive_Letters', - config_file => 'storage.config', - value => 'b,c,d,e,f,g,h,i,j,k,l,m,n,o', - }, - }, - ## id => 15 - 'Drive_Prefix' => { - new => 'Parameter', - using => { - name => 'Drive_Prefix', - config_file => 'storage.config', - value => '/dev/sd', - }, - }, - ## id => 16 - 'error_url' => { + health_threadhold_loadavg => { new => 'Parameter', using => { - name => 'error_url', - config_file => 'url_sig_cdl-c2.config', - value => '403', + id => 4, + name => 'health.threshold.loadavg', + value => '25.0', + config_file => 'rascal.properties', }, }, - ## id => 17 health_threadhold_available_bandwidth_in_kbps => { new => 'Parameter', using => { + id => 5, name => 'health.threshold.availableBandwidthInKbps', value => '>1750000', config_file => 'rascal.properties', }, }, - ## id => 18 - health_threadhold_loadavg => { - new => 'Parameter', - using => { - name => 'health.threshold.loadavg', - value => '25.0', - config_file => 'rascal.properties', - }, - }, - ## id => 19 history_count => { new => 'Parameter', using => { + id => 6, name => 'history.count', value => '30', config_file => 'rascal.properties', }, }, - ## id => 20 'key0' => { new => 'Parameter', using => { + id => 7, name => 'key0', config_file => 'url_sig_cdl-c2.config', value => 'HOOJ3Ghq1x4gChp3iQkqVTcPlOj8UCi3', }, }, - ## id => 21 'key1' => { new => 'Parameter', using => { + id => 8, name => 'key1', config_file => 'url_sig_cdl-c2.config', value => '_9LZYkRnfCS0rCBF7fTQzM9Scwlp2FhO', }, }, - ## id => 22 'key2' => { new => 'Parameter', using => { + id => 9, name => 'key2', config_file => 'url_sig_cdl-c2.config', value => 'AFpkxfc4oTiyFSqtY6_ohjt3V80aAIxS', }, }, - ## id => 23 'key3' => { new => 'Parameter', using => { + id => 10, name => 'key3', config_file => 'url_sig_cdl-c2.config', value => 'AL9kzs_SXaRZjPWH8G5e2m4ByTTzkzlc', }, }, - ## id => 24 'key4' => { new => 'Parameter', using => { + id => 11, name => 'key4', config_file => 'url_sig_cdl-c2.config', value => 'poP3n3szbD1U4vx1xQXV65BvkVgWzfN8', }, }, - ## id => 25 'key5' => { new => 'Parameter', using => { + id => 12, name => 'key5', config_file => 'url_sig_cdl-c2.config', value => '1ir32ng4C4w137p5oq72kd2wqmIZUrya', }, }, - ## id => 26 'key6' => { new => 'Parameter', using => { + id => 13, name => 'key6', config_file => 'url_sig_cdl-c2.config', value => 'B1qLptn2T1b_iXeTCWDcVuYvANtH139f', }, }, - ## id => 27 'key7' => { new => 'Parameter', using => { + id => 14, name => 'key7', config_file => 'url_sig_cdl-c2.config', value => 'PiCV_5OODMzBbsNFMWsBxcQ8v1sK0TYE', }, }, - ## id => 28 'key8' => { new => 'Parameter', using => { + id => 15, name => 'key8', config_file => 'url_sig_cdl-c2.config', value => 'Ggpv6DqXDvt2s1CETPBpNKwaLk4fTM9l', }, }, - ## id => 29 'key9' => { new => 'Parameter', using => { + id => 16, name => 'key9', config_file => 'url_sig_cdl-c2.config', value => 'qPlVT_s6kL37aqb6hipDm4Bt55S72mI7', }, }, - ## id => 30 'key10' => { new => 'Parameter', using => { + id => 17, name => 'key10', config_file => 'url_sig_cdl-c2.config', value => 'BsI5A9EmWrobIS1FeuOs1z9fm2t2WSBe', }, }, - ## id => 31 'key11' => { new => 'Parameter', using => { + id => 18, name => 'key11', config_file => 'url_sig_cdl-c2.config', value => 'A54y66NCIj897GjS4yA9RrsSPtCUnQXP', }, }, - ## id => 32 'key12' => { new => 'Parameter', using => { + id => 19, name => 'key12', config_file => 'url_sig_cdl-c2.config', value => '2jZH0NDPSJttIr4c2KP510f47EKqTQAu', }, }, - ## id => 33 'key13' => { new => 'Parameter', using => { + id => 20, name => 'key13', config_file => 'url_sig_cdl-c2.config', value => 'XduT2FBjBmmVID5JRB5LEf9oR5QDtBgC', }, }, - ## id => 34 'key14' => { new => 'Parameter', using => { + id => 21, name => 'key14', config_file => 'url_sig_cdl-c2.config', value => 'D9nH0SvK_0kP5w8QNd1UFJ28ulFkFKPn', }, }, - ## id => 35 'key15' => { new => 'Parameter', using => { + id => 22, name => 'key15', config_file => 'url_sig_cdl-c2.config', value => 'udKXWYNwbXXweaaLzaKDGl57OixnIIcm', }, }, - ## id => 36 + 'url_sig_cdl-c2.config_location' => { + new => 'Parameter', + using => { + id => 23, + name => 'location', + config_file => 'url_sig_cdl-c2.config', + value => '/opt/trafficserver/etc/trafficserver', + }, + }, + 'error_url' => { + new => 'Parameter', + using => { + id => 24, + name => 'error_url', + config_file => 'url_sig_cdl-c2.config', + value => '403', + }, + }, + 'CONFIG-proxy.config.allocator.debug_filter' => { + new => 'Parameter', + using => { + id => 25, + name => 'CONFIG proxy.config.allocator.debug_filter', + config_file => 'records.config', + value => 'INT 0', + }, + }, + 'CONFIG-proxy.config.allocator.enable_reclaim' => { + new => 'Parameter', + using => { + id => 26, + name => 'CONFIG proxy.config.allocator.enable_reclaim', + config_file => 'records.config', + value => 'INT 0', + }, + }, + 'CONFIG-proxy.config.allocator.max_overage' => { + new => 'Parameter', + using => { + id => 27, + name => 'CONFIG proxy.config.allocator.max_overage', + config_file => 'records.config', + value => 'INT 3', + }, + }, + 'CONFIG-proxy.config.diags.show_location' => { + new => 'Parameter', + using => { + id => 28, + name => 'CONFIG proxy.config.diags.show_location', + config_file => 'records.config', + value => 'INT 0', + }, + }, + 'CONFIG-proxy.config.http.cache.allow_empty_doc' => { + new => 'Parameter', + using => { + id => 29, + name => 'CONFIG proxy.config.http.cache.allow_empty_doc', + config_file => 'records.config', + value => 'INT 0', + }, + }, 'LOCAL-proxy.config.cache.interim.storage' => { new => 'Parameter', using => { + id => 30, name => 'LOCAL proxy.config.cache.interim.storage', config_file => 'records.config', value => 'STRING NULL', }, }, - ## id => 37 - 'url_sig_cdl-c2.config_location' => { + 'CONFIG-proxy.config.http.parent_proxy.file' => { new => 'Parameter', using => { - name => 'location', - config_file => 'url_sig_cdl-c2.config', - value => '/opt/trafficserver/etc/trafficserver', + id => 31, + name => 'CONFIG proxy.config.http.parent_proxy.file', + config_file => 'records.config', + value => 'STRING parent.config', }, }, - ## id => 38 '12M_location' => { new => 'Parameter', using => { + id => 32, name => 'location', config_file => '12M_facts', value => '/opt/ort', }, }, - ## id => 39 'cacheurl_location' => { new => 'Parameter', using => { + id => 33, name => 'location', config_file => 'cacheurl.config', value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 40 'ip_allow_location' => { new => 'Parameter', using => { + id => 34, name => 'location', config_file => 'ip_allow.config', value => '/opt/trafficserver/etc/trafficserver', }, }, - ## id => 41 + 'astats_over_http.so' => { + new => 'Parameter', + using => { + id => 35, + name => 'astats_over_http.so', + config_file => 'plugin.config', + value => '_astats 33.101.99.100,172.39.19.39,172.39.19.49,172.39.19.49,172.39.29.49', + }, + }, 'crontab_root_location' => { new => 'Parameter', using => { + id => 36, name => 'location', config_file => 'crontab_root', value => '/var/spool/cron', }, }, - ## id => 42 'hdr_rw_cdl-c2.config_location' => { new => 'Parameter', using => { + id => 37, name => 'location', config_file => 'hdr_rw_cdl-c2.config', value => '/opt/trafficserver/etc/trafficserver', }, }, - ## id => 43 '50-ats.rules_location' => { new => 'Parameter', using => { + id => 38, name => 'location', config_file => '50-ats.rules', value => '/etc/udev/rules.d/', }, }, - ## id => 44 'parent.config_location' => { new => 'Parameter', using => { + id => 39, name => 'location', config_file => 'parent.config', value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 45 'remap.config_location' => { new => 'Parameter', using => { + id => 40, name => 'location', config_file => 'remap.config', value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 46 'drop_qstring.config_location' => { new => 'Parameter', using => { + id => 41, name => 'location', config_file => 'drop_qstring.config', value => '/opt/trafficserver/etc/trafficserver', }, }, - ## id => 47 + 'LogFormat.Format' => { + new => 'Parameter', + using => { + id => 42, + name => 'LogFormat.Format', + config_file => 'logs_xml.config', + value => + '% chi=% phn=% shn=% url=% cqhm=% cqhv=% pssc=% ttms=% b=% sssc=% sscl=% cfsc=% pfsc=% crc=% phr=% uas="%<{User-Agent}cqh>"', + }, + }, + 'LogFormat.Name' => { + new => 'Parameter', + using => { + id => 43, + name => 'LogFormat.Name', + config_file => 'logs_xml.config', + value => 'custom_ats_2', + }, + }, + 'LogObject.Format' => { + new => 'Parameter', + using => { + id => 44, + name => 'LogObject.Format', + config_file => 'logs_xml.config', + value => 'custom_ats_2', + }, + }, + 'LogObject.Filename' => { + new => 'Parameter', + using => { + id => 45, + name => 'LogObject.Filename', + config_file => 'logs_xml.config', + value => 'custom_ats_2', + }, + }, 'cache.config_location' => { new => 'Parameter', using => { + id => 46, name => 'location', config_file => 'cache.config', value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 48 + 'CONFIG-proxy.config.cache.control.filename' => { + new => 'Parameter', + using => { + id => 47, + name => 'CONFIG proxy.config.cache.control.filename', + config_file => 'records.config', + value => 'STRING cache.config', + }, + }, + 'regex_revalidate.so' => { + new => 'Parameter', + using => { + id => 48, + name => 'regex_revalidate.so', + config_file => 'plugin.config', + value => '--config regex_revalidate.config', + }, + }, 'regex_revalidate.config_location' => { new => 'Parameter', using => { + id => 49, name => 'location', config_file => 'regex_revalidate.config', value => '/opt/trafficserver/etc/trafficserver', }, }, - ## id => 49 'hosting.config_location' => { new => 'Parameter', using => { + id => 50, name => 'location', config_file => 'hosting.config', value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 50 'volume.config_location' => { new => 'Parameter', using => { + id => 51, name => 'location', config_file => 'volume.config', value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 51 - 'astats.config_location' => { + 'allow_ip' => { new => 'Parameter', using => { - name => 'location', + id => 52, + name => 'allow_ip', config_file => 'astats.config', - value => '/opt/trafficserver/etc/trafficserver', + value => '127.0.0.1,172.39.0.0/16,33.101.99.0/24', }, }, - ## id => 52 - 'storage.config_location' => { + 'allow_ip6' => { new => 'Parameter', using => { - name => 'location', - config_file => 'storage.config', - value => '/opt/trafficserver/etc/trafficserver/', + id => 53, + name => 'allow_ip6', + config_file => 'astats.config', + value => '::1,2033:D011:3300::336/64,2033:D011:3300::335/64,2033:D021:3300::333/64,2033:D021:3300::334/64', }, }, - ## id => 53 - 'LogFormat.Format' => { + 'record_types' => { new => 'Parameter', using => { - name => 'LogFormat.Format', - config_file => 'logs_xml.config', - value => - '% chi=% phn=% shn=% url=% cqhm=% cqhv=% pssc=% ttms=% b=% sssc=% sscl=% cfsc=% pfsc=% crc=% phr=% uas="%<{User-Agent}cqh>"', + id => 54, + name => 'record_types', + config_file => 'astats.config', + value => '144', }, }, - ## id => 54 - 'LogFormat.Name' => { + 'astats.config_location' => { new => 'Parameter', using => { - name => 'LogFormat.Name', - config_file => 'logs_xml.config', - value => 'custom_ats_2', + id => 55, + name => 'location', + config_file => 'astats.config', + value => '/opt/trafficserver/etc/trafficserver', }, }, - ## id => 55 - 'LogObject.Format' => { + 'astats.config_path' => { new => 'Parameter', using => { - name => 'LogObject.Format', - config_file => 'logs_xml.config', - value => 'custom_ats_2', + id => 56, + name => 'path', + config_file => 'astats.config', + value => '_astats', }, }, - ## id => 56 - 'LogObject.Filename' => { + 'storage.config_location' => { new => 'Parameter', using => { - name => 'LogObject.Filename', - config_file => 'logs_xml.config', - value => 'custom_ats_2', + id => 57, + name => 'location', + config_file => 'storage.config', + value => '/opt/trafficserver/etc/trafficserver/', }, }, - ## id => 57 - 'regex_revalidate.config_max_days' => { + 'Drive_Prefix' => { new => 'Parameter', using => { - name => 'maxRevalDurationDays', - config_file => 'regex_revalidate.config', - value => 90, + id => 58, + name => 'Drive_Prefix', + config_file => 'storage.config', + value => '/dev/sd', }, }, - ## id => 58 - 'regex_revalidate.config_maxRevalDurationDays' => { + 'Drive_Letters' => { new => 'Parameter', using => { - name => 'maxRevalDurationDays', - config_file => 'regex_revalidate.config', - value => 90, + id => 59, + name => 'Drive_Letters', + config_file => 'storage.config', + value => 'b,c,d,e,f,g,h,i,j,k,l,m,n,o', }, }, - ## id => 59 - 'astats.config_path' => { + 'Disk_Volume' => { new => 'Parameter', using => { - name => 'path', - config_file => 'astats.config', - value => '_astats', + id => 60, + name => 'Disk_Volume', + config_file => 'storage.config', + value => '1', }, }, - ## id => 60 - 'record_types' => { + 'CONFIG-proxy.config.hostdb.storage_size' => { new => 'Parameter', using => { - name => 'record_types', - config_file => 'astats.config', - value => '144', + id => 61, + name => 'CONFIG proxy.config.hostdb.storage_size', + config_file => 'records.config', + value => 'INT 33554432', }, }, - ## id => 61 - 'regex_revalidate.so' => { + 'regex_revalidate.config_snapshot_dir' => { new => 'Parameter', using => { - name => 'regex_revalidate.so', - config_file => 'plugin.config', - value => '--config regex_revalidate.config', + id => 62, + name => 'snapshot_dir', + config_file => 'regex_revalidate.config', + value => 'public/Trafficserver-Snapshots/', }, }, - ## id => 62 - 'regex_revalidate.config_snapshot_dir' => { + 'regex_revalidate.config_max_days' => { new => 'Parameter', using => { - name => 'snapshot_dir', + id => 63, + name => 'maxRevalDurationDays', config_file => 'regex_revalidate.config', - value => 'public/Trafficserver-Snapshots/', + value => 3, + }, + }, + 'regex_revalidate.config_maxRevalDurationDays' => { + new => 'Parameter', + using => { + id => 64, + name => 'maxRevalDurationDays', + config_file => 'regex_revalidate.config', + value => 90, }, - } + }, ); sub get_definition { @@ -587,7 +587,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { lc($definition_for{$a}{using}{name}) cmp lc($definition_for{$b}{using}{name}) } keys %definition_for); + return (sort { lc($definition_for{$a}{using}{id}) cmp lc($definition_for{$b}{using}{name}) } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Profile.pm b/traffic_ops/app/lib/Fixtures/Profile.pm index cea8182e1c..f4765b3abc 100644 --- a/traffic_ops/app/lib/Fixtures/Profile.pm +++ b/traffic_ops/app/lib/Fixtures/Profile.pm @@ -18,54 +18,54 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 - CCR1 => { - new => 'Profile', - using => { - name => 'CCR1', - description => 'ccr description', - }, - }, - ## id => 2 EDGE1 => { new => 'Profile', using => { + id => 1, name => 'EDGE1', description => 'edge description', }, }, - ## id => 3 MID1 => { new => 'Profile', using => { + id => 2, name => 'MID1', description => 'mid description', }, }, - ## id => 4 + CCR1 => { + new => 'Profile', + using => { + id => 3, + name => 'CCR1', + description => 'ccr description', + }, + }, + RIAK1 => { + new => 'Profile', + using => { + id => 5, + name => 'RIAK1', + description => 'riak description', + }, + }, RASCAL1 => { new => 'Profile', using => { + id => 6, name => 'RASCAL1', description => 'rascal description', }, }, - ## id => 5 RASCAL2 => { new => 'Profile', using => { + id => 7, name => 'RASCAL2', description => 'rascal2 description', }, }, - ## id => 6 - RIAK1 => { - new => 'Profile', - using => { - name => 'RIAK1', - description => 'riak description', - }, - }, ); sub get_definition { @@ -76,7 +76,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/ProfileParameter.pm b/traffic_ops/app/lib/Fixtures/ProfileParameter.pm index 99693478fa..e5a306ebee 100644 --- a/traffic_ops/app/lib/Fixtures/ProfileParameter.pm +++ b/traffic_ops/app/lib/Fixtures/ProfileParameter.pm @@ -19,839 +19,839 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - domain_name3 => { - new => 'ProfileParameter', - using => { - profile => 1, - parameter => 13, - }, - }, - 'edge1_allow_ip' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 1, - }, - }, - 'edge1_allow_ip6' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 2, - }, - }, - 'edge1_astats_over_http.so' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 3, - }, - }, - 'edge1_CONFIG-proxy.config.allocator.debug_filter' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 4, - }, - }, - 'edge1_CONFIG-proxy.config.allocator.enable_reclaim' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 5, - }, - }, - 'edge1_CONFIG-proxy.config.allocator.max_overage' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 6, - }, - }, - 'edge1_CONFIG-proxy.config.cache.control.filename' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 7, - }, - }, - 'edge1_CONFIG-proxy.config.diags.show_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 8, - }, - }, - 'edge1_CONFIG-proxy.config.http.cache.allow_empty_doc' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 9, - }, - }, - 'edge1_CONFIG-proxy.config.http.parent_proxy.file' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 10, - }, - }, - 'edge1_CONFIG-proxy.config.hostdb.storage_size' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 11, - }, - }, - 'edge1_Disk_Volume' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 12, - }, - }, - domain_name => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 13, - }, - }, - 'edge1_Drive_Letters' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 14, - }, - }, - 'edge1_Drive_Prefix' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 15, - }, - }, - 'edge1_error_url' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 16, - }, - }, - edge1_key0 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 20, - }, - }, - edge1_key1 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 21, - }, - }, - edge1_key2 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 22, - }, - }, - edge1_key3 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 23, - }, - }, - edge1_key4 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 24, - }, - }, - edge1_key5 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 25, - }, - }, - edge1_key6 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 26, - }, - }, - edge1_key7 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 27, - }, - }, - edge1_key8 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 28, - }, - }, - edge1_key9 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 29, - }, - }, - edge1_key10 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 30, - }, - }, - edge1_key11 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 31, - }, - }, - edge1_key12 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 32, - }, - }, - edge1_key13 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 33, - }, - }, - edge1_key14 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 34, - }, - }, - edge1_key15 => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 35, - }, - }, - 'LOCAL-proxy.config.cache.interim.storage' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 36, - }, - }, - 'edge1_url_sig_cdl-c2.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 37, - }, - }, - 'edge1_12M_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 38, - }, - }, - 'edge1_cacheurl_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 39, - }, - }, - 'edge1_ip_allow_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 40, - }, - }, - 'edge1_crontab_root_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 41, - }, - }, - 'edge1_hdr_rw_cdl-c2.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 42, - }, - }, - 'edge1_50-ats.rules_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 43, - }, - }, - 'edge1_parent.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 44, - }, - }, - 'edge1_remap.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 45, - }, - }, - 'edge1_drop_qstring.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 46, - }, - }, - 'edge1_cache.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 47, - }, - }, - 'edge1_regex_revalidate.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 48, - }, - }, - 'edge1_hosting.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 49, - }, - }, - 'edge1_volume.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 50, - }, - }, - 'edge1_astats.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 51, - }, - }, - 'edge1_storage.config_location' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 52, - }, - }, - 'edge1_LogFormat.Format' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 53, - }, - }, - 'edge1_LogFormat.Name' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 54, - }, - }, - 'edge1_LogObject.Format' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 55, - }, - }, - 'edge1_LogObject.Filename' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 56, - }, - }, - 'edge1_astats.config_path' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 59, - }, - }, - 'edge1_record_types' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 60, - }, - }, - 'edge1_regex_revalidate.so' => { - new => 'ProfileParameter', - using => { - profile => 2, - parameter => 61, - }, - }, - 'mid1_allow_ip' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 1, - }, - }, - 'mid1_allow_ip6' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 2, - }, - }, - 'mid1_astats_over_http.so' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 3, - }, - }, - 'mid1_CONFIG-proxy.config.allocator.debug_filter' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 4, - }, - }, - 'mid1_CONFIG-proxy.config.allocator.enable_reclaim' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 5, - }, - }, - 'mid1_CONFIG-proxy.config.allocator.max_overage' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 6, - }, - }, - 'mid1_CONFIG-proxy.config.cache.control.filename' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 7, - }, - }, - 'mid1_CONFIG-proxy.config.diags.show_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 8, - }, - }, - 'mid1_CONFIG-proxy.config.http.cache.allow_empty_doc' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 9, - }, - }, - 'mid1_CONFIG-proxy.config.http.parent_proxy.file' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 10, - }, - }, - 'mid1_CONFIG-proxy.config.hostdb.storage_size' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 11, - }, - }, - 'mid1_Disk_Volume' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 12, - }, - }, - domain_name2 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 13, - }, - }, - 'mid1_Drive_Letters' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 14, - }, - }, - 'mid1_Drive_Prefix' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 15, - }, - }, - 'mid1_error_url' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 16, - }, - }, - rascal_properties2 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 17, - }, - }, - rascal_properties1 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 18, - }, - }, - rascal_properties2 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 19, - }, - }, - mid1_key0 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 20, - }, - }, - mid1_key1 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 21, - }, - }, - mid1_key2 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 22, - }, - }, - mid1_key3 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 23, - }, - }, - mid1_key4 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 24, - }, - }, - mid1_key5 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 25, - }, - }, - mid1_key6 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 26, - }, - }, - mid1_key7 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 27, - }, - }, - mid1_key8 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 28, - }, - }, + domain_name => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 3, + }, + }, + domain_name2 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 3, + }, + }, + domain_name3 => { + new => 'ProfileParameter', + using => { + profile => 3, + parameter => 3, + }, + }, + domain_name5 => { + new => 'ProfileParameter', + using => { + profile => 5, + parameter => 3, + }, + }, + domain_name6 => { + new => 'ProfileParameter', + using => { + profile => 6, + parameter => 3, + }, + }, + domain_name7 => { + new => 'ProfileParameter', + using => { + profile => 7, + parameter => 3, + }, + }, + rascal_properties1 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 4, + }, + }, + rascal_properties2 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 5, + }, + }, + rascal_properties2 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 6, + }, + }, + edge1_key0 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 7, + }, + }, + edge1_key1 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 8, + }, + }, + edge1_key2 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 9, + }, + }, + edge1_key3 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 10, + }, + }, + edge1_key4 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 11, + }, + }, + edge1_key5 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 12, + }, + }, + edge1_key6 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 13, + }, + }, + edge1_key7 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 14, + }, + }, + edge1_key8 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 15, + }, + }, + edge1_key9 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 16, + }, + }, + edge1_key10 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 17, + }, + }, + edge1_key11 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 18, + }, + }, + edge1_key12 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 19, + }, + }, + edge1_key13 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 20, + }, + }, + edge1_key14 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 21, + }, + }, + edge1_key15 => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 22, + }, + }, + 'edge1_url_sig_cdl-c2.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 23, + }, + }, + 'edge1_error_url' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 24, + }, + }, + 'edge1_CONFIG-proxy.config.allocator.debug_filter' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 25, + }, + }, + 'edge1_CONFIG-proxy.config.allocator.enable_reclaim' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 26, + }, + }, + 'edge1_CONFIG-proxy.config.allocator.max_overage' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 27, + }, + }, + 'edge1_CONFIG-proxy.config.diags.show_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 28, + }, + }, + 'edge1_CONFIG-proxy.config.http.cache.allow_empty_doc' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 29, + }, + }, + 'LOCAL-proxy.config.cache.interim.storage' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 30, + }, + }, + 'edge1_CONFIG-proxy.config.http.parent_proxy.file' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 31, + }, + }, + 'edge1_12M_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 32, + }, + }, + 'edge1_cacheurl_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 33, + }, + }, + 'edge1_ip_allow_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 34, + }, + }, + 'edge1_astats_over_http.so' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 35, + }, + }, + 'edge1_crontab_root_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 36, + }, + }, + 'edge1_hdr_rw_cdl-c2.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 37, + }, + }, + 'edge1_50-ats.rules_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 38, + }, + }, + 'edge1_parent.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 39, + }, + }, + 'edge1_remap.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 40, + }, + }, + 'edge1_drop_qstring.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 41, + }, + }, + 'edge1_LogFormat.Format' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 42, + }, + }, + 'edge1_LogFormat.Name' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 43, + }, + }, + 'edge1_LogObject.Format' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 44, + }, + }, + 'edge1_LogObject.Filename' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 45, + }, + }, + 'edge1_cache.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 46, + }, + }, + 'edge1_CONFIG-proxy.config.cache.control.filename' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 47, + }, + }, + 'edge1_regex_revalidate.so' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 48, + }, + }, + 'edge1_regex_revalidate.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 49, + }, + }, + 'edge1_hosting.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 50, + }, + }, + 'edge1_volume.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 51, + }, + }, + 'edge1_allow_ip' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 52, + }, + }, + 'edge1_allow_ip6' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 53, + }, + }, + 'edge1_record_types' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 54, + }, + }, + 'edge1_astats.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 55, + }, + }, + 'edge1_astats.config_path' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 56, + }, + }, + 'edge1_storage.config_location' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 57, + }, + }, + 'edge1_Drive_Prefix' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 58, + }, + }, + 'edge1_Drive_Letters' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 59, + }, + }, + 'edge1_Disk_Volume' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 60, + }, + }, + 'edge1_CONFIG-proxy.config.hostdb.storage_size' => { + new => 'ProfileParameter', + using => { + profile => 1, + parameter => 61, + }, + }, + mid1_key0 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 7, + }, + }, + mid1_key1 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 8, + }, + }, + mid1_key2 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 9, + }, + }, + mid1_key3 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 10, + }, + }, + mid1_key4 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 11, + }, + }, + mid1_key5 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 12, + }, + }, + mid1_key6 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 13, + }, + }, + mid1_key7 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 14, + }, + }, + mid1_key8 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 15, + }, + }, mid1_key9 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 29, - }, - }, - mid1_key10 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 30, - }, - }, - mid1_key11 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 31, - }, - }, - mid1_key12 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 32, - }, - }, - mid1_key13 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 33, - }, - }, - mid1_key14 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 34, - }, - }, - mid1_key15 => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 35, - }, - }, - 'LOCAL-proxy.config.cache.interim.storage' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 36, - }, - }, - 'mid1_url_sig_cdl-c2.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 37, - }, - }, - 'mid1_12M_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 38, - }, - }, - 'mid1_cacheurl_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 39, - }, - }, - 'mid1_ip_allow_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 40, - }, - }, - 'mid1_crontab_root_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 41, - }, - }, - 'mid1_hdr_rw_cdl-c2.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 42, - }, - }, - 'mid1_50-ats.rules_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 43, - }, - }, - 'mid1_parent.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 44, - }, - }, - 'mid1_remap.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 45, - }, - }, - 'mid1_drop_qstring.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 46, - }, - }, - 'mid1_cache.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 47, - }, - }, - 'mid1_regex_revalidate.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 48, - }, - }, - 'mid1_hosting.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 49, - }, - }, - 'mid1_volume.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 50, - }, - }, - 'mid1_astats.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 51, - }, - }, - 'mid1_storage.config_location' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 52, - }, - }, - 'mid1_LogFormat.Format' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 53, - }, - }, - 'mid1_LogFormat.Name' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 54, - }, - }, - 'mid1_LogObject.Format' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 55, - }, - }, - 'mid1_LogObject.Filename' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 56, - }, - }, - 'mid1_astats.config_path' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 59, - }, - }, - 'mid1_record_types' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 60, - }, - }, - 'mid1_regex_revalidate.so' => { - new => 'ProfileParameter', - using => { - profile => 3, - parameter => 61, - }, - }, - domain_name6 => { - new => 'ProfileParameter', - using => { - profile => 4, - parameter => 13, - }, - }, - domain_name7 => { - new => 'ProfileParameter', - using => { - profile => 5, - parameter => 13, - }, - }, - domain_name5 => { - new => 'ProfileParameter', - using => { - profile => 6, - parameter => 13, - }, - }, + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 16, + }, + }, + mid1_key10 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 17, + }, + }, + mid1_key11 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 18, + }, + }, + mid1_key12 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 19, + }, + }, + mid1_key13 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 20, + }, + }, + mid1_key14 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 21, + }, + }, + mid1_key15 => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 22, + }, + }, + 'mid1_url_sig_cdl-c2.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 23, + }, + }, + 'mid1_error_url' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 24, + }, + }, + 'mid1_CONFIG-proxy.config.allocator.debug_filter' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 25, + }, + }, + 'mid1_CONFIG-proxy.config.allocator.enable_reclaim' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 26, + }, + }, + 'mid1_CONFIG-proxy.config.allocator.max_overage' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 27, + }, + }, + 'mid1_CONFIG-proxy.config.diags.show_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 28, + }, + }, + 'mid1_CONFIG-proxy.config.http.cache.allow_empty_doc' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 29, + }, + }, + 'LOCAL-proxy.config.cache.interim.storage' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 30, + }, + }, + 'mid1_CONFIG-proxy.config.http.parent_proxy.file' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 31, + }, + }, + 'mid1_12M_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 32, + }, + }, + 'mid1_cacheurl_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 33, + }, + }, + 'mid1_ip_allow_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 34, + }, + }, + 'mid1_astats_over_http.so' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 35, + }, + }, + 'mid1_crontab_root_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 36, + }, + }, + 'mid1_hdr_rw_cdl-c2.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 37, + }, + }, + 'mid1_50-ats.rules_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 38, + }, + }, + 'mid1_parent.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 39, + }, + }, + 'mid1_remap.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 40, + }, + }, + 'mid1_drop_qstring.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 41, + }, + }, + 'mid1_LogFormat.Format' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 42, + }, + }, + 'mid1_LogFormat.Name' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 43, + }, + }, + 'mid1_LogObject.Format' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 44, + }, + }, + 'mid1_LogObject.Filename' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 45, + }, + }, + 'mid1_cache.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 46, + }, + }, + 'mid1_CONFIG-proxy.config.cache.control.filename' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 47, + }, + }, + 'mid1_regex_revalidate.so' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 48, + }, + }, + 'mid1_regex_revalidate.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 49, + }, + }, + 'mid1_hosting.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 50, + }, + }, + 'mid1_volume.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 51, + }, + }, + 'mid1_allow_ip' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 52, + }, + }, + 'mid1_allow_ip6' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 53, + }, + }, + 'mid1_record_types' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 54, + }, + }, + 'mid1_astats.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 55, + }, + }, + 'mid1_astats.config_path' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 56, + }, + }, + 'mid1_storage.config_location' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 57, + }, + }, + 'mid1_Drive_Prefix' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 58, + }, + }, + 'mid1_Drive_Letters' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 59, + }, + }, + 'mid1_Disk_Volume' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 60, + }, + }, + 'mid1_CONFIG-proxy.config.hostdb.storage_size' => { + new => 'ProfileParameter', + using => { + profile => 2, + parameter => 61, + }, + }, ); sub get_definition { diff --git a/traffic_ops/app/lib/Fixtures/Region.pm b/traffic_ops/app/lib/Fixtures/Region.pm index 0926a55220..cecf71c476 100644 --- a/traffic_ops/app/lib/Fixtures/Region.pm +++ b/traffic_ops/app/lib/Fixtures/Region.pm @@ -18,18 +18,18 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 mile_high => { new => 'Region', using => { + id => 1, name => 'Denver Region', division => 1, }, }, - ## id => 2 boulder => { new => 'Region', using => { + id => 2, name => 'Boulder Region', division => 1, }, diff --git a/traffic_ops/app/lib/Fixtures/Role.pm b/traffic_ops/app/lib/Fixtures/Role.pm index b3f3499901..098748679b 100644 --- a/traffic_ops/app/lib/Fixtures/Role.pm +++ b/traffic_ops/app/lib/Fixtures/Role.pm @@ -19,73 +19,73 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - ## id => 1 - admin => { + disallowed => { new => 'Role', using => { - name => 'admin', - description => 'super-user', - priv_level => 30, + id => 1, + name => 'disallowed', + description => 'block all access', + priv_level => 0, }, }, - ## id => 2 - disallowed => { + read_only => { new => 'Role', using => { - name => 'disallowed', + id => 2, + name => 'read-only user', description => 'block all access', - priv_level => 0, + priv_level => 10, }, }, - ## id => 3 federation => { new => 'Role', using => { + id => 7, name => 'federation', description => 'Role for Secondary CZF', priv_level => 11, }, }, - ## id => 4 - migrations => { + operations => { new => 'Role', using => { - name => 'migrations', - description => 'database migrations user - DO NOT REMOVE', + id => 3, + name => 'operations', + description => 'block all access', priv_level => 20, }, }, - ## id => 5 - operations => { + admin => { new => 'Role', using => { - name => 'operations', - description => 'block all access', + id => 4, + name => 'admin', + description => 'super-user', + priv_level => 30, + }, + }, + migrations => { + new => 'Role', + using => { + id => 5, + name => 'migrations', + description => 'database migrations user - DO NOT REMOVE', priv_level => 20, }, }, - ## id => 6 portal => { new => 'Role', using => { + id => 6, name => 'portal', description => 'Portal User', priv_level => 2, }, }, - ## id => 7 - read_only => { - new => 'Role', - using => { - name => 'read-only user', - description => 'block all access', - priv_level => 10, - }, - }, - ## id => 8 steering => { new => 'Role', using => { + id => 8, name => 'steering', description => 'Role for Steering Delivery Service', priv_level => 11, diff --git a/traffic_ops/app/lib/Fixtures/Server.pm b/traffic_ops/app/lib/Fixtures/Server.pm index eb90b0449c..47348b94aa 100644 --- a/traffic_ops/app/lib/Fixtures/Server.pm +++ b/traffic_ops/app/lib/Fixtures/Server.pm @@ -18,10 +18,10 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 server_edge1 => { new => 'Server', using => { + id => 1, host_name => 'atlanta-edge-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -45,29 +45,29 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 9, - status => 4, - profile => 2, + type => 1, + status => 2, + profile => 1, cdn_id => 1, cachegroup => 3, phys_location => 1, }, }, - ## id => 2 - server_edge2 => { + server_mid1 => { new => 'Server', using => { - host_name => 'atlanta-edge-02', + id => 2, + host_name => 'atlanta-mid-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, - xmpp_id => 'atlanta-edge-02\@ocdn.kabletown.net', + xmpp_id => 'atlanta-mid-01\@ocdn.kabletown.net', xmpp_passwd => 'X', interface_name => 'bond0', - ip_address => '127.0.0.7', + ip_address => '127.0.0.2', ip_netmask => '255.255.255.252', - ip_gateway => '127.0.0.7', - ip6_address => '2345:1234:12:d::2/64', - ip6_gateway => '2345:1234:12:d::1', + ip_gateway => '127.0.0.2', + ip6_address => '2345:1234:12:9::2/64', + ip6_gateway => '2345:1234:12:9::1', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', @@ -80,29 +80,29 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 9, - status => 4, + type => 2, + status => 2, profile => 2, cdn_id => 1, - cachegroup => 3, + cachegroup => 1, phys_location => 1, }, }, - ## id => 3 - server_edge_reported => { + rascal_server => { new => 'Server', using => { - host_name => 'atlanta-edge-03', - domain_name => 'ga.atlanta.kabletown.net', - tcp_port => 80, - xmpp_id => 'atlanta-edge-03\@ocdn.kabletown.net', + id => 4, + host_name => 'rascal01', + domain_name => 'kabletown.net', + tcp_port => 81, + xmpp_id => 'rascal\@kabletown.net', xmpp_passwd => 'X', interface_name => 'bond0', - ip_address => '127.0.0.13', + ip_address => '127.0.0.4', ip_netmask => '255.255.255.252', - ip_gateway => '127.0.0.1', - ip6_address => '2345:1234:12:2::2/64', - ip6_gateway => '2345:1234:12:8::1', + ip_gateway => '127.0.0.4', + ip6_address => '2345:1234:12:b::2/64', + ip6_gateway => '2345:1234:12:b::1', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', @@ -115,29 +115,99 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 9, - status => 4, - profile => 2, + type => 14, + status => 2, + profile => 6, cdn_id => 1, - cachegroup => 3, + cachegroup => 1, phys_location => 1, }, }, - ## id => 4 - server_mid1 => { + riak_server1 => { new => 'Server', using => { - host_name => 'atlanta-mid-01', + id => 5, + host_name => 'riak01', + domain_name => 'kabletown.net', + tcp_port => 8088, + xmpp_id => '', + xmpp_passwd => '', + interface_name => 'eth1', + ip_address => '127.0.0.5', + ip_netmask => '255.255.252.0', + ip_gateway => '127.0.0.5', + ip6_address => '', + ip6_gateway => '', + interface_mtu => 1500, + rack => 'RR 119.02', + mgmt_ip_address => '', + mgmt_ip_netmask => '', + mgmt_ip_gateway => '', + ilo_ip_address => '', + ilo_ip_netmask => '', + ilo_ip_gateway => '', + ilo_username => '', + ilo_password => '', + router_host_name => '', + router_port_name => '', + type => 31, + status => 2, + profile => 5, + cdn_id => 1, + cachegroup => 1, + phys_location => 1, + }, + }, + rascal_server2 => { + new => 'Server', + using => { + id => 6, + host_name => 'rascal02', + domain_name => 'kabletown.net', + tcp_port => 81, + xmpp_id => 'rascal\@kabletown.net', + xmpp_passwd => 'X', + interface_name => 'bond0', + ip_address => '127.0.0.6', + ip_netmask => '255.255.255.252', + ip_gateway => '127.0.0.6', + ip6_address => '2345:1234:12:c::2/64', + ip6_gateway => '2345:1234:12:c::1', + interface_mtu => 9000, + rack => 'RR 119.05', + mgmt_ip_address => '', + mgmt_ip_netmask => '', + mgmt_ip_gateway => '', + ilo_ip_address => '', + ilo_ip_netmask => '', + ilo_ip_gateway => '', + ilo_username => '', + ilo_password => '', + router_host_name => '', + router_port_name => '', + type => 14, + status => 2, + profile => 7, + cdn_id => 2, + cachegroup => 1, + phys_location => 1, + }, + }, + server_edge2 => { + new => 'Server', + using => { + id => 7, + host_name => 'atlanta-edge-02', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, - xmpp_id => 'atlanta-mid-01\@ocdn.kabletown.net', + xmpp_id => 'atlanta-edge-02\@ocdn.kabletown.net', xmpp_passwd => 'X', interface_name => 'bond0', - ip_address => '127.0.0.2', + ip_address => '127.0.0.7', ip_netmask => '255.255.255.252', - ip_gateway => '127.0.0.2', - ip6_address => '2345:1234:12:9::2/64', - ip6_gateway => '2345:1234:12:9::1', + ip_gateway => '127.0.0.7', + ip6_address => '2345:1234:12:d::2/64', + ip6_gateway => '2345:1234:12:d::1', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', @@ -150,18 +220,18 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 18, - status => 4, - profile => 3, + type => 1, + status => 2, + profile => 1, cdn_id => 1, - cachegroup => 1, + cachegroup => 3, phys_location => 1, }, }, - ## id => 5 server_mid2 => { new => 'Server', using => { + id => 8, host_name => 'atlanta-mid-02', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -185,30 +255,30 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 18, - status => 4, - profile => 3, + type => 2, + status => 2, + profile => 2, cdn_id => 2, cachegroup => 2, phys_location => 2, }, }, - ## id => 6 - server_router => { + riak_server2 => { new => 'Server', using => { - host_name => 'atlanta-router-01', - domain_name => 'ga.atlanta.kabletown.net', - tcp_port => 80, - xmpp_id => 'atlanta-router-01\@ocdn.kabletown.net', - xmpp_passwd => 'X', - interface_name => 'bond0', - ip_address => '127.0.0.12', - ip_netmask => '255.255.255.252', - ip_gateway => '127.0.0.1', - ip6_address => '2345:1234:12:8::10/64', - ip6_gateway => '2345:1234:12:8::1', - interface_mtu => 9000, + id => 9, + host_name => 'riak02', + domain_name => 'kabletown.net', + tcp_port => 8088, + xmpp_id => '', + xmpp_passwd => '', + interface_name => 'eth1', + ip_address => '127.0.0.9', + ip_netmask => '255.255.252.0', + ip_gateway => '127.0.0.9', + ip6_address => '2345:1234:12:f::2/64', + ip6_gateway => '2345:1234:12:f::1', + interface_mtu => 1500, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', @@ -220,18 +290,18 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 5, - status => 4, - profile => 2, + type => 31, + status => 2, + profile => 5, cdn_id => 1, - cachegroup => 3, - phys_location => 1, + cachegroup => 1, + phys_location => 2, }, }, - ## id => 7 influxdb_server1 => { new => 'Server', using => { + id => 10, host_name => 'influxdb01', domain_name => 'kabletown.net', tcp_port => 8086, @@ -255,18 +325,18 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 16, - status => 4, - profile => 4, + type => 32, + status => 2, + profile => 5, cdn_id => 1, cachegroup => 1, phys_location => 3, }, }, - ## id => 8 influxdb_server2 => { new => 'Server', using => { + id => 11, host_name => 'influxdb02', domain_name => 'kabletown.net', tcp_port => 8086, @@ -290,29 +360,29 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 16, - status => 4, - profile => 4, + type => 32, + status => 2, + profile => 5, cdn_id => 1, cachegroup => 1, phys_location => 3, }, }, - ## id => 9 - rascal_server => { + server_router => { new => 'Server', using => { - host_name => 'rascal01', - domain_name => 'kabletown.net', - tcp_port => 81, - xmpp_id => 'rascal\@kabletown.net', + id => 12, + host_name => 'atlanta-router-01', + domain_name => 'ga.atlanta.kabletown.net', + tcp_port => 80, + xmpp_id => 'atlanta-router-01\@ocdn.kabletown.net', xmpp_passwd => 'X', interface_name => 'bond0', - ip_address => '127.0.0.4', + ip_address => '127.0.0.12', ip_netmask => '255.255.255.252', - ip_gateway => '127.0.0.4', - ip6_address => '2345:1234:12:b::2/64', - ip6_gateway => '2345:1234:12:b::1', + ip_gateway => '127.0.0.1', + ip6_address => '2345:1234:12:8::10/64', + ip6_gateway => '2345:1234:12:8::1', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', @@ -325,31 +395,31 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 23, - status => 4, - profile => 6, + type => 4, + status => 2, + profile => 1, cdn_id => 1, - cachegroup => 1, + cachegroup => 3, phys_location => 1, }, }, - ## id => 10 - rascal_server2 => { + server_edge_reported => { new => 'Server', using => { - host_name => 'rascal02', - domain_name => 'kabletown.net', - tcp_port => 81, - xmpp_id => 'rascal\@kabletown.net', + id => 13, + host_name => 'atlanta-edge-03', + domain_name => 'ga.atlanta.kabletown.net', + tcp_port => 80, + xmpp_id => 'atlanta-edge-03\@ocdn.kabletown.net', xmpp_passwd => 'X', interface_name => 'bond0', - ip_address => '127.0.0.6', + ip_address => '127.0.0.13', ip_netmask => '255.255.255.252', - ip_gateway => '127.0.0.6', - ip6_address => '2345:1234:12:c::2/64', - ip6_gateway => '2345:1234:12:c::1', + ip_gateway => '127.0.0.1', + ip6_address => '2345:1234:12:2::2/64', + ip6_gateway => '2345:1234:12:8::1', interface_mtu => 9000, - rack => 'RR 119.05', + rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', @@ -360,30 +430,30 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 23, - status => 4, - profile => 4, - cdn_id => 2, - cachegroup => 1, + type => 1, + status => 3, + profile => 1, + cdn_id => 1, + cachegroup => 3, phys_location => 1, }, }, - ## id => 11 - riak_server1 => { + server_edge14 => { new => 'Server', using => { - host_name => 'riak01', - domain_name => 'kabletown.net', - tcp_port => 8088, - xmpp_id => '', - xmpp_passwd => '', - interface_name => 'eth1', - ip_address => '127.0.0.5', - ip_netmask => '255.255.252.0', - ip_gateway => '127.0.0.5', - ip6_address => '', - ip6_gateway => '', - interface_mtu => 1500, + id => 14, + host_name => 'atlanta-edge-14', + domain_name => 'ga.atlanta.kabletown.net', + tcp_port => 80, + xmpp_id => 'atlanta-edge-14\@ocdn.kabletown.net', + xmpp_passwd => 'X', + interface_name => 'bond0', + ip_address => '127.0.0.14', + ip_netmask => '255.255.255.252', + ip_gateway => '127.0.0.1', + ip6_address => '2345:1234:12:8::14/64', + ip6_gateway => '2345:1234:12:8::1', + interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', @@ -395,30 +465,30 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 26, - status => 4, - profile => 4, + type => 1, + status => 2, + profile => 1, cdn_id => 1, - cachegroup => 1, + cachegroup => 9, phys_location => 1, }, }, - ## id => 12 - riak_server2 => { + server_edge15 => { new => 'Server', using => { - host_name => 'riak02', - domain_name => 'kabletown.net', - tcp_port => 8088, - xmpp_id => '', - xmpp_passwd => '', - interface_name => 'eth1', - ip_address => '127.0.0.9', - ip_netmask => '255.255.252.0', - ip_gateway => '127.0.0.9', - ip6_address => '2345:1234:12:f::2/64', - ip6_gateway => '2345:1234:12:f::1', - interface_mtu => 1500, + id => 15, + host_name => 'atlanta-edge-15', + domain_name => 'ga.atlanta.kabletown.net', + tcp_port => 80, + xmpp_id => 'atlanta-edge-15\@ocdn.kabletown.net', + xmpp_passwd => 'X', + interface_name => 'bond0', + ip_address => '127.0.0.15', + ip_netmask => '255.255.255.252', + ip_gateway => '127.0.0.7', + ip6_address => '2345:1234:12:d::15/64', + ip6_gateway => '2345:1234:12:d::1', + interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', @@ -430,14 +500,49 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 26, - status => 4, - profile => 4, + type => 1, + status => 2, + profile => 1, cdn_id => 1, - cachegroup => 1, - phys_location => 2, + cachegroup => 9, + phys_location => 1, }, - } + }, + server_mid16 => { + new => 'Server', + using => { + id => 16, + host_name => 'atlanta-mid-16', + domain_name => 'ga.atlanta.kabletown.net', + tcp_port => 80, + xmpp_id => 'atlanta-mid-16\@ocdn.kabletown.net', + xmpp_passwd => 'X', + interface_name => 'bond0', + ip_address => '127.0.0.16', + ip_netmask => '255.255.255.252', + ip_gateway => '127.0.0.7', + ip6_address => '2345:1234:12:d::16/64', + ip6_gateway => '2345:1234:12:d::1', + interface_mtu => 9000, + rack => 'RR 119.02', + mgmt_ip_address => '', + mgmt_ip_netmask => '', + mgmt_ip_gateway => '', + ilo_ip_address => '', + ilo_ip_netmask => '', + ilo_ip_gateway => '', + ilo_username => '', + ilo_password => '', + router_host_name => '', + router_port_name => '', + type => 1, + status => 2, + profile => 1, + cdn_id => 1, + cachegroup => 8, + phys_location => 1, + }, + }, ); sub get_definition { @@ -447,7 +552,7 @@ sub get_definition { sub all_fixture_names { # sort by db xml_id to guarantee insertion order - return (sort { $definition_for{$a}{using}{host_name} cmp $definition_for{$b}{using}{host_name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Status.pm b/traffic_ops/app/lib/Fixtures/Status.pm index 8a79440ae5..ca2c352e93 100644 --- a/traffic_ops/app/lib/Fixtures/Status.pm +++ b/traffic_ops/app/lib/Fixtures/Status.pm @@ -18,57 +18,57 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 - status_admin_down => { - new => 'Status', - using => { - name => 'ADMIN_DOWN', - description => - 'Temporary down. Edge: XMPP client will send status OFFLINE to CCR, otherwise similar to REPORTED. Mid: Server will not be included in parent.config files for its edge caches', - }, - }, - ## id => 2 - status_ccr_ignore => { - new => 'Status', - using => { - name => 'CCR_IGNORE', - description => 'Edge: 12M will not include caches in this state in CCR config files. Mid: N/A for now', - }, - }, - ## id => 3 status_offline => { new => 'Status', using => { + id => 1, name => 'OFFLINE', description => 'Edge: Puts server in CCR config file in this state, but CCR will never route traffic to it. Mid: Server will not be included in parent.config files for its edge caches', }, }, - ## id => 4 status_online => { new => 'Status', using => { + id => 2, name => 'ONLINE', description => 'Edge: Puts server in CCR config file in this state, and CCR will always route traffic to it. Mid: Server will be included in parent.config files for its edges', }, }, - ## id => 5 - status_pre_prod => { + status_reported => { + new => 'Status', + using => { + id => 3, + name => 'REPORTED', + description => 'Edge: Puts server in CCR config file in this state, and CCR will adhere to the health protocol. Mid: N/A for now', + }, + }, + status_admin_down => { new => 'Status', using => { - name => 'PRE_PROD', - description => 'Pre Production. Not active in any configuration.', + id => 4, + name => 'ADMIN_DOWN', + description => + 'Temporary down. Edge: XMPP client will send status OFFLINE to CCR, otherwise similar to REPORTED. Mid: Server will not be included in parent.config files for its edge caches', }, }, - ## id => 6 - status_reported => { + status_ccr_ignore => { new => 'Status', using => { - name => 'REPORTED', - description => 'Edge: Puts server in CCR config file in this state, and CCR will adhere to the health protocol. Mid: N/A for now', + id => 5, + name => 'CCR_IGNORE', + description => 'Edge: 12M will not include caches in this state in CCR config files. Mid: N/A for now', }, }, + status_pre_prod => { + new => 'Status', + using => { + id => 6, + name => 'PRE_PROD', + description => 'Pre Production. Not active in any configuration.', + }, + }, ); sub get_definition { @@ -78,7 +78,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{name} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Type.pm b/traffic_ops/app/lib/Fixtures/Type.pm index 6a83897c92..ce46c137c7 100644 --- a/traffic_ops/app/lib/Fixtures/Type.pm +++ b/traffic_ops/app/lib/Fixtures/Type.pm @@ -289,7 +289,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; From 0a78634df5b175742ff33de804b001ca6c106422 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Wed, 16 Nov 2016 10:20:47 -0700 Subject: [PATCH 02/38] more fixture migration from master --- traffic_ops/app/lib/Fixtures/Cachegroup.pm | 24 +- .../app/lib/Fixtures/EdgeCachegroup.pm | 3 +- traffic_ops/app/lib/Fixtures/Regex.pm | 78 ++--- traffic_ops/app/lib/Fixtures/Type.pm | 296 +++++++++--------- 4 files changed, 205 insertions(+), 196 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Cachegroup.pm b/traffic_ops/app/lib/Fixtures/Cachegroup.pm index 28f8e1f057..ad0e9197c7 100644 --- a/traffic_ops/app/lib/Fixtures/Cachegroup.pm +++ b/traffic_ops/app/lib/Fixtures/Cachegroup.pm @@ -18,27 +18,27 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 mid_northeast => { new => 'Cachegroup', using => { + id => 1, name => 'mid-northeast-group', short_name => 'ne', - type => 18, - latitude => 98.0, - longitude => 98.0, + type => 2, + latitude => 120, + longitude => 120, parent_cachegroup_id => undef, }, }, - ## id => 2 mid_northwest => { new => 'Cachegroup', using => { + id => 2, name => 'mid-northwest-group', short_name => 'nw', - type => 18, - latitude => 98.0, - longitude => 98.0, + type => 2, + latitude => 100, + longitude => 100, parent_cachegroup_id => 1, }, }, @@ -49,8 +49,8 @@ my %definition_for = ( name => 'mid_cg3', short_name => 'mid_cg3', type => 6, - latitude => 98.0, - longitude => 98.0, + latitude => 100, + longitude => 100, parent_cachegroup_id => undef, }, }, @@ -61,8 +61,8 @@ my %definition_for = ( name => 'edge_cg4', short_name => 'edge_cg4', type => 5, - latitude => 98.0, - longitude => 98.0, + latitude => 100, + longitude => 100, parent_cachegroup_id => 8, }, }, diff --git a/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm b/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm index 6d68d1a332..371c015222 100644 --- a/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm +++ b/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm @@ -21,9 +21,10 @@ my %definition_for = ( edge_atl => { new => 'Cachegroup', using => { + id => 3, name => 'edge_atl_group', short_name => 'atl', - type => 10, + type => 5, latitude => 120, longitude => 120, parent_cachegroup_id => 1, diff --git a/traffic_ops/app/lib/Fixtures/Regex.pm b/traffic_ops/app/lib/Fixtures/Regex.pm index c72a3adf15..abc2d946d3 100644 --- a/traffic_ops/app/lib/Fixtures/Regex.pm +++ b/traffic_ops/app/lib/Fixtures/Regex.pm @@ -18,108 +18,108 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 + regex_omg01 => { + new => 'Regex', + using => { + id => 1, + pattern => '.*\.omg-01\..*', + type => 19, + }, + }, + regex_1 => { + new => 'Regex', + using => { + id => 2, + pattern => '.*\.foo\..*', + type => 19, + }, + }, target_filter_1 => { new => 'Regex', using => { + id => 3, pattern => '.*/force-to-one/.*', - type => 28, + type => 20, }, }, - ## id => 2 target_filter_1_2 => { new => 'Regex', using => { + id => 4, pattern => '.*/force-to-one-also/.*', - type => 28, + type => 20, }, }, - ## id => 3 target_filter_4 => { new => 'Regex', using => { + id => 5, pattern => '.*/go-to-four/.*', - type => 28, + type => 20, }, }, - ## id => 4 target_filter_3 => { new => 'Regex', using => { + id => 6, pattern => '.*/use-three/.*', - type => 28, + type => 20, }, }, - ## id => 5 - regex_1 => { - new => 'Regex', - using => { - pattern => '.*\.foo\..*', - type => 15, - }, - }, - ## id => 6 hr_new_steering => { new => 'Regex', using => { + id => 7, pattern => '.*\.new-steering-ds\..*', - type => 15, - }, - }, - ## id => 7 - regex_omg01 => { - new => 'Regex', - using => { - pattern => '.*\.omg-01\..*', - type => 15, + type => 19, }, }, - ## id => 8 hr_steering_1 => { new => 'Regex', using => { + id => 8, pattern => '.*\.steering-ds1\..*', - type => 15, + type => 19, }, }, - ## id => 9 hr_steering_2 => { new => 'Regex', using => { + id => 9, pattern => '.*\.steering-ds2\..*', - type => 15, + type => 19, }, }, - ## id => 10 hr_target_1 => { new => 'Regex', using => { + id => 10, pattern => '.*\.target-ds1\..*', - type => 15, + type => 19, }, }, - ## id => 11 hr_target_2 => { new => 'Regex', using => { + id => 11, pattern => '.*\.target-ds2\..*', - type => 15, + type => 19, }, }, - ## id => 12 hr_target_3 => { new => 'Regex', using => { + id => 12, pattern => '.*\.target-ds3\..*', - type => 15, + type => 19, }, }, - ## id => 13 hr_target_4 => { new => 'Regex', using => { + id => 13, pattern => '.*\.target-ds4\..*', - type => 15, + type => 19, }, }, ); @@ -131,7 +131,7 @@ sub get_definition { sub all_fixture_names { # sort by db pattern to guarantee insertion order - return (sort { $definition_for{$a}{using}{pattern} cmp $definition_for{$b}{using}{pattern} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Type.pm b/traffic_ops/app/lib/Fixtures/Type.pm index ce46c137c7..5749f88f5f 100644 --- a/traffic_ops/app/lib/Fixtures/Type.pm +++ b/traffic_ops/app/lib/Fixtures/Type.pm @@ -19,265 +19,274 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - ## id => 1 - AAAA_RECORD => { - new => 'Type', - using => { - name => 'AAAA_RECORD', - description => 'Static DNS AAAA entry', - use_in_table => 'staticdnsentry', - } - }, - ## id => 2 - ACTIVE_DIRECTORY => { + EDGE => { new => 'Type', using => { - name => 'ACTIVE_DIRECTORY', - description => 'Active Directory User', - use_in_table => 'tm_user', - } + id => 1, + name => 'EDGE', + description => 'Edge Cache', + use_in_table => 'server', + }, }, - ## id => 3 - A_RECORD => { + MID => { new => 'Type', using => { - name => 'A_RECORD', - description => 'Static DNS A entry', - use_in_table => 'staticdnsentry', - } + id => 2, + name => 'MID', + description => 'Mid Tier Cache', + use_in_table => 'server', + }, }, - ## id => 4 - ANY_MAP => { + ORG => { new => 'Type', using => { - name => 'ANY_MAP', - description => 'any_map type', - use_in_table => 'deliveryservice', - } + id => 3, + name => 'ORG', + description => 'Origin', + use_in_table => 'server', + }, }, - ## id => 5 CCR => { new => 'Type', using => { + id => 4, name => 'CCR', description => 'Kabletown Content Router', use_in_table => 'server', }, }, - ## id => 6 - CNAME_RECORD => { + EDGE_LOC => { new => 'Type', using => { - name => 'CNAME_RECORD', - description => 'Static DNS CNAME entry', - use_in_table => 'staticdnsentry', - } + id => 5, + name => 'EDGE_LOC', + description => 'Edge Cachegroup', + use_in_table => 'cachegroup', + }, }, - ## id => 7 - DNS => { + MID_LOC => { new => 'Type', using => { - name => 'DNS', - description => 'DNS Content Routing', - use_in_table => 'deliveryservice', + id => 6, + name => 'MID_LOC', + description => 'Mid Cachegroup', + use_in_table => 'cachegroup', }, }, - ## id => 8 - DNS_LIVE_NATNL => { + DNS => { new => 'Type', using => { - name => 'DNS_LIVE_NATNL', - description => 'DNS Content routing, RAM cache, National', + id => 7, + name => 'DNS', + description => 'DNS Content Routing', use_in_table => 'deliveryservice', - } - }, - ## id => 9 - EDGE => { - new => 'Type', - using => { - name => 'EDGE', - description => 'Edge Cache', - use_in_table => 'server', }, }, - ## id => 10 - EDGE_LOC => { + OTHER_CDN => { new => 'Type', using => { - name => 'EDGE_LOC', - description => 'Edge Cachegroup', - use_in_table => 'cachegroup', + id => 8, + name => 'OTHER_CDN', + description => 'Other CDN (CDS-IS, Akamai, etc)', + use_in_table => 'server', }, }, - ## id => 11 - HTTP => { + HTTP_NO_CACHE => { new => 'Type', using => { - name => 'HTTP', - description => 'HTTP Content routing cache ', + id => 9, + name => 'HTTP_NO_CACHE', + description => 'HTTP Content Routing, no caching', use_in_table => 'deliveryservice', }, }, - ## id => 12 HTTP_LIVE => { new => 'Type', using => { + id => 11, name => 'HTTP_LIVE', description => 'HTTP Content routing cache in RAM ', use_in_table => 'deliveryservice', }, }, - ## id => 13 - HTTP_LIVE_NATNL => { + HTTP_LIVE => { new => 'Type', using => { - name => 'HTTP_LIVE_NATNL', - description => 'HTTP Content routing, RAM cache, National', + id => 12, + name => 'HTTP_LIVE', + description => 'HTTP Content routing cache in RAM ', use_in_table => 'deliveryservice', - } + }, }, - ## id => 14 - HTTP_NO_CACHE => { + RASCAL => { new => 'Type', using => { - name => 'HTTP_NO_CACHE', - description => 'HTTP Content Routing, no caching', - use_in_table => 'deliveryservice', + id => 14, + name => 'RASCAL', + description => 'Rascal health polling & reporting', + use_in_table => 'server', }, }, - ## id => 15 HOST_REGEXP => { new => 'Type', using => { + id => 19, name => 'HOST_REGEXP', description => 'Host header regular expression', use_in_table => 'regex', }, }, - ## id => 16 - INFLUXDB => { + PATH_REGEXP => { new => 'Type', using => { - name => 'INFLUXDB', - description => 'influxdb type', - use_in_table => 'server', + id => 20, + name => 'PATH_REGEXP', + description => 'Path regular expression', + use_in_table => 'regex', + }, + }, + A_RECORD => { + new => 'Type', + using => { + id => 21, + name => 'A_RECORD', + description => 'Static DNS A entry', + use_in_table => 'staticdnsentry', } }, - ## id => 17 - LOCAL => { + AAAA_RECORD => { new => 'Type', using => { - name => 'LOCAL', - description => 'Local User', - use_in_table => 'tm_user', + id => 22, + name => 'AAAA_RECORD', + description => 'Static DNS AAAA entry', + use_in_table => 'staticdnsentry', } }, - ## id => 18 - MID => { + CNAME_RECORD => { new => 'Type', using => { - name => 'MID', - description => 'Mid Tier Cache', - use_in_table => 'server', - }, + id => 23, + name => 'CNAME_RECORD', + description => 'Static DNS CNAME entry', + use_in_table => 'staticdnsentry', + } }, - ## id => 19 - MID_LOC => { + HTTP_LIVE_NATNL => { new => 'Type', using => { - name => 'MID_LOC', - description => 'Mid Cachegroup', - use_in_table => 'cachegroup', - }, + id => 24, + name => 'HTTP_LIVE_NATNL', + description => 'HTTP Content routing, RAM cache, National', + use_in_table => 'deliveryservice', + } }, - ## id => 20 - ORG => { + DNS_LIVE_NATNL => { new => 'Type', using => { - name => 'ORG', - description => 'Origin', - use_in_table => 'server', - }, + id => 26, + name => 'DNS_LIVE_NATNL', + description => 'DNS Content routing, RAM cache, National', + use_in_table => 'deliveryservice', + } }, - ## id => 21 - OTHER_CDN => { + DNS_LIVE_NATNL => { new => 'Type', using => { - name => 'OTHER_CDN', - description => 'Other CDN (CDS-IS, Akamai, etc)', + id => 27, + name => 'DNS_LIVE_NATNL', + description => 'DNS Content routing, RAM cache, National', + use_in_table => 'deliveryservice', + } + }, + LOCAL => { + new => 'Type', + using => { + id => 28, + name => 'LOCAL', + description => 'Local User', + use_in_table => 'tm_user', + } + }, + ACTIVE_DIRECTORY => { + new => 'Type', + using => { + id => 29, + name => 'ACTIVE_DIRECTORY', + description => 'Active Directory User', + use_in_table => 'tm_user', + } + }, + TOOLS_SERVER => { + new => 'Type', + using => { + id => 30, + name => 'TOOLS_SERVER', + description => 'Ops hosts for management', use_in_table => 'server', - }, + } }, - ## id => 22 - PATH_REGEXP => { + RIAK => { new => 'Type', using => { - name => 'PATH_REGEXP', - description => 'Path regular expression', - use_in_table => 'regex', - }, + id => 31, + name => 'RIAK', + description => 'riak type', + use_in_table => 'server', + } }, - ## id => 23 - RASCAL => { + INFLUXDB => { new => 'Type', using => { - name => 'RASCAL', - description => 'Rascal health polling & reporting', + id => 32, + name => 'INFLUXDB', + description => 'influxdb type', use_in_table => 'server', - }, + } }, - ## id => 24 RESOLVE4 => { new => 'Type', using => { + id => 33, name => 'RESOLVE4', description => 'federation type resolve4', use_in_table => 'federation', } }, - ## id => 25 RESOLVE6 => { new => 'Type', using => { + id => 34, name => 'RESOLVE6', description => 'federation type resolve6', use_in_table => 'federation', }, }, - ## id => 26 - RIAK => { - new => 'Type', - using => { - name => 'RIAK', - description => 'riak type', - use_in_table => 'server', - } - }, - ## id => 27 - STEERING => { + ANY_MAP => { new => 'Type', using => { - name => 'STEERING', - description => 'Steering Delivery Service', + id => 35, + name => 'ANY_MAP', + description => 'any_map type', use_in_table => 'deliveryservice', } }, - ## id => 28 - STEERING_REGEXP => { + HTTP => { new => 'Type', using => { - name => 'STEERING_REGEXP', - description => 'Steering target filter regular expression', - use_in_table => 'regex', + id => 36, + name => 'HTTP', + description => 'HTTP Content routing cache ', + use_in_table => 'deliveryservice', }, }, - ## id => 29 - TOOLS_SERVER => { + STEERING => { new => 'Type', using => { - name => 'TOOLS_SERVER', - description => 'Ops hosts for management', - use_in_table => 'server', + id => 37, + name => 'STEERING', + description => 'Steering Delivery Service', + use_in_table => 'deliveryservice', } } ); @@ -288,8 +297,7 @@ sub get_definition { } sub all_fixture_names { - # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); + return keys %definition_for; } __PACKAGE__->meta->make_immutable; From d6e92bdba5178f7992cc37b38f75482d6f391da9 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Wed, 16 Nov 2016 10:52:26 -0700 Subject: [PATCH 03/38] checkpoint update for fixture alignment --- traffic_ops/app/lib/Fixtures/Cdn.pm | 2 + .../app/lib/Fixtures/Deliveryservice.pm | 387 +++++++++--------- .../app/lib/Fixtures/DeliveryserviceServer.pm | 23 +- .../app/lib/Fixtures/DeliveryserviceTmuser.pm | 8 +- traffic_ops/app/lib/Fixtures/TmUser.pm | 74 ++-- .../app/t/api/1.1/deliveryserviceserver.t | 2 +- 6 files changed, 246 insertions(+), 250 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Cdn.pm b/traffic_ops/app/lib/Fixtures/Cdn.pm index 61223d51e5..dacb60428d 100644 --- a/traffic_ops/app/lib/Fixtures/Cdn.pm +++ b/traffic_ops/app/lib/Fixtures/Cdn.pm @@ -23,6 +23,7 @@ my %definition_for = ( cdn1_cdn_name => { new => 'Cdn', using => { + id => 1, name => 'cdn1', }, }, @@ -30,6 +31,7 @@ my %definition_for = ( cdn2_cdn_name => { new => 'Cdn', using => { + id => 2, name => 'cdn2', }, }, diff --git a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm index 37b56992a0..7198e0100f 100644 --- a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm +++ b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm @@ -19,30 +19,30 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 - steering_ds1 => { - new => 'Deliveryservice', + ds_cdn1 => { + new => 'Deliveryservice', using => { id => 1, - xml_id => 'steering-ds1', + xml_id => 'test-ds1', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => 'hokeypokey', - dns_bypass_ttl => 10, + dns_bypass_ip => '', + dns_bypass_ip6 => '', + dns_bypass_ttl => -1, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'steering-ds1 long_desc', - long_desc_1 => 'steering-ds1 long_desc_1', - long_desc_2 => 'steering-ds1 long_desc_2', + long_desc => 'test-ds1 long_desc', + long_desc_1 => 'test-ds1 long_desc_1', + long_desc_2 => 'test-ds1 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://steering-ds1.edge', - info_url => 'http://steering-ds1.edge/info_url.html', + org_server_fqdn => 'http://test-ds1.edge', + info_url => 'http://test-ds1.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', @@ -51,202 +51,207 @@ my %definition_for = ( cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, - display_name => 'steering-ds1-displayname', + display_name => 'test-ds1-displayname', initial_dispersion => 1, regional_geo_blocking => 1, + logs_enabled => 1, }, }, - ## id => 2 - steering_ds2 => { + ds_cdn2 => { new => 'Deliveryservice', using => { id => 2, - xml_id => 'steering-ds2', + xml_id => 'test-ds2', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => 'hokeypokey', - dns_bypass_ttl => 10, + dns_bypass_ip => '', + dns_bypass_ip6 => '', + dns_bypass_ttl => -1, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'steering-ds2 long_desc', - long_desc_1 => 'steering-ds2 long_desc_1', - long_desc_2 => 'steering-ds2 long_desc_2', + long_desc => 'test-ds2 long_desc', + long_desc_1 => 'test-ds2 long_desc_1', + long_desc_2 => 'test-ds2 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://steering-ds2.edge', - info_url => 'http://steering-ds2.edge/info_url.html', + org_server_fqdn => 'http://test-ds2.edge', + info_url => 'http://test-ds2.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 21, + type => 9, profile => 1, cdn_id => 1, - ipv6_routing_enabled => 1, - protocol => 1, - display_name => 'steering-ds2-displayname', + display_name => 'test-ds2-displayname', initial_dispersion => 1, - regional_geo_blocking => 1, + geo_provider => 0, + regional_geo_blocking => 0, + ipv6_routing_enabled => 0, + logs_enabled => 0, }, }, - ## id => 3 - new_steering => { + ds_cdn3 => { new => 'Deliveryservice', using => { id => 3, - xml_id => 'steering-ds3', + xml_id => 'test-ds3', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => 'hokeypokey', - dns_bypass_ttl => 10, + dns_bypass_ip => '', + dns_bypass_ip6 => '', + dns_bypass_ttl => -1, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'new-steering-ds long_desc', - long_desc_1 => 'new-steering-ds long_desc_1', - long_desc_2 => 'new-steering-ds long_desc_2', + long_desc => 'test-ds3 long_desc', + long_desc_1 => 'test-ds3 long_desc_1', + long_desc_2 => 'test-ds3 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://new-steering-ds.edge', - info_url => 'http://new-steering-ds.edge/info_url.html', + org_server_fqdn => 'http://test-ds3.edge', + info_url => 'http://test-ds3.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 21, + type => 9, profile => 1, cdn_id => 1, - ipv6_routing_enabled => 1, - protocol => 1, - display_name => 'new-steering-ds-displayname', + display_name => 'test-ds3-displayname', initial_dispersion => 1, - regional_geo_blocking => 1, + geo_provider => 0, + regional_geo_blocking => 0, + ipv6_routing_enabled => 0, + logs_enabled => 0, }, }, - ## id => 4 - target_ds1 => { + ds_cdn4 => { new => 'Deliveryservice', using => { id => 4, - xml_id => 'steering-target-ds1', + xml_id => 'test-ds4', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => 'hokeypokey', - dns_bypass_ttl => 10, + dns_bypass_ip => '', + dns_bypass_ip6 => '', + dns_bypass_ttl => -1, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'target-ds1 long_desc', - long_desc_1 => 'target-ds1 long_desc_1', - long_desc_2 => 'target-ds1 long_desc_2', + long_desc => 'test-ds4 long_desc', + long_desc_1 => 'test-ds4 long_desc_1', + long_desc_2 => 'test-ds4 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://target-ds1.edge', - info_url => 'http://target-ds1.edge/info_url.html', + org_server_fqdn => 'http://test-ds4.edge', + info_url => 'http://test-ds4.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 21, + type => 9, profile => 1, cdn_id => 1, - ipv6_routing_enabled => 1, - protocol => 1, - display_name => 'target-ds1-displayname', + display_name => 'test-ds4-displayname', initial_dispersion => 1, - regional_geo_blocking => 1, + geo_provider => 0, + regional_geo_blocking => 0, + ipv6_routing_enabled => 0, + logs_enabled => 1, }, }, - ## id => 5 - target_ds2 => { + ds_dns => { new => 'Deliveryservice', using => { id => 5, - xml_id => 'steering-target-ds2', + xml_id => 'test-ds5', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => 'hokeypokey', - dns_bypass_ttl => 10, + dns_bypass_ip => '', + dns_bypass_ip6 => '', + dns_bypass_ttl => -1, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'target-ds2 long_desc', - long_desc_1 => 'target-ds2 long_desc_1', - long_desc_2 => 'target-ds2 long_desc_2', + long_desc => 'test-ds5 long_desc', + long_desc_1 => 'test-ds5 long_desc_1', + long_desc_2 => 'test-ds5 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://target-ds2.edge', - info_url => 'http://target-ds2.edge/info_url.html', + org_server_fqdn => 'http://test-ds5.edge', + info_url => 'http://test-ds5.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 21, - profile => 1, + type => 7, + profile => 3, cdn_id => 1, - ipv6_routing_enabled => 1, - protocol => 1, - display_name => 'target-ds2-displayname', + display_name => 'test-ds5-displayname', initial_dispersion => 1, - regional_geo_blocking => 1, + geo_provider => 0, + regional_geo_blocking => 0, + ipv6_routing_enabled => 0, + logs_enabled => 0, }, }, - ## id => 6 - target_ds3 => { + ds_http_no_cache => { new => 'Deliveryservice', using => { id => 6, - xml_id => 'steering-target-ds3', + xml_id => 'test-ds6', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => 'hokeypokey', - dns_bypass_ttl => 10, + dns_bypass_ip => '', + dns_bypass_ip6 => '', + dns_bypass_ttl => -1, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'target-ds3 long_desc', - long_desc_1 => 'target-ds3 long_desc_1', - long_desc_2 => 'target-ds3 long_desc_2', + long_desc => 'test-ds6 long_desc', + long_desc_1 => 'test-ds6 long_desc_1', + long_desc_2 => 'test-ds6 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://target-ds3.edge', - info_url => 'http://target-ds3.edge/info_url.html', + org_server_fqdn => 'http://test-ds6.edge', + info_url => 'http://test-ds6.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 21, - profile => 1, + type => 9, + profile => 3, cdn_id => 1, - ipv6_routing_enabled => 1, - protocol => 1, - display_name => 'target-ds3-displayname', + display_name => 'test-ds6-displayname', initial_dispersion => 1, - regional_geo_blocking => 1, + geo_provider => 0, + regional_geo_blocking => 0, + ipv6_routing_enabled => 0, + logs_enabled => 0, }, }, - ## id => 7 - target_ds4 => { + steering_ds1 => { new => 'Deliveryservice', using => { id => 7, - xml_id => 'steering-target-ds4', + xml_id => 'steering-ds1', active => 1, dscp => 40, signed => 0, @@ -258,13 +263,13 @@ my %definition_for = ( ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'target-ds4 long_desc', - long_desc_1 => 'target-ds4 long_desc_1', - long_desc_2 => 'target-ds4 long_desc_2', + long_desc => 'steering-ds1 long_desc', + long_desc_1 => 'steering-ds1 long_desc_1', + long_desc_2 => 'steering-ds1 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://target-ds4.edge', - info_url => 'http://target-ds4.edge/info_url.html', + org_server_fqdn => 'http://steering-ds1.edge', + info_url => 'http://steering-ds1.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', @@ -273,36 +278,34 @@ my %definition_for = ( cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, - display_name => 'target-ds4-displayname', + display_name => 'steering-ds1-displayname', initial_dispersion => 1, regional_geo_blocking => 1, }, }, - ## id => 8 - ds_cdn1 => { - new => 'Deliveryservice', + steering_ds2 => { + new => 'Deliveryservice', using => { id => 8, - xml_id => 'test-ds1', + xml_id => 'steering-ds2', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => '', - dns_bypass_ip6 => '', - dns_bypass_ttl => -1, + dns_bypass_ip => 'hokeypokey', + dns_bypass_ttl => 10, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'test-ds1 long_desc', - long_desc_1 => 'test-ds1 long_desc_1', - long_desc_2 => 'test-ds1 long_desc_2', + long_desc => 'steering-ds2 long_desc', + long_desc_1 => 'steering-ds2 long_desc_1', + long_desc_2 => 'steering-ds2 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://test-ds1.edge', - info_url => 'http://test-ds1.edge/info_url.html', + org_server_fqdn => 'http://steering-ds2.edge', + info_url => 'http://steering-ds2.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', @@ -311,203 +314,193 @@ my %definition_for = ( cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, - display_name => 'test-ds1-displayname', + display_name => 'steering-ds2-displayname', initial_dispersion => 1, regional_geo_blocking => 1, - logs_enabled => 1, }, }, - ## id => 9 - ds_cdn2 => { + new_steering => { new => 'Deliveryservice', using => { id => 9, - xml_id => 'test-ds2', + xml_id => 'steering-ds3', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => '', - dns_bypass_ip6 => '', - dns_bypass_ttl => -1, + dns_bypass_ip => 'hokeypokey', + dns_bypass_ttl => 10, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'test-ds2 long_desc', - long_desc_1 => 'test-ds2 long_desc_1', - long_desc_2 => 'test-ds2 long_desc_2', + long_desc => 'new-steering-ds long_desc', + long_desc_1 => 'new-steering-ds long_desc_1', + long_desc_2 => 'new-steering-ds long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://test-ds2.edge', - info_url => 'http://test-ds2.edge/info_url.html', + org_server_fqdn => 'http://new-steering-ds.edge', + info_url => 'http://new-steering-ds.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 9, + type => 21, profile => 1, cdn_id => 1, - display_name => 'test-ds2-displayname', + ipv6_routing_enabled => 1, + protocol => 1, + display_name => 'new-steering-ds-displayname', initial_dispersion => 1, - geo_provider => 0, - regional_geo_blocking => 0, - ipv6_routing_enabled => 0, - logs_enabled => 0, + regional_geo_blocking => 1, }, }, - ## id => 10 - ds_cdn3 => { + ## id => 4 + target_ds1 => { new => 'Deliveryservice', using => { id => 10, - xml_id => 'test-ds3', + xml_id => 'steering-target-ds1', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => '', - dns_bypass_ip6 => '', - dns_bypass_ttl => -1, + dns_bypass_ip => 'hokeypokey', + dns_bypass_ttl => 10, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'test-ds3 long_desc', - long_desc_1 => 'test-ds3 long_desc_1', - long_desc_2 => 'test-ds3 long_desc_2', + long_desc => 'target-ds1 long_desc', + long_desc_1 => 'target-ds1 long_desc_1', + long_desc_2 => 'target-ds1 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://test-ds3.edge', - info_url => 'http://test-ds3.edge/info_url.html', + org_server_fqdn => 'http://target-ds1.edge', + info_url => 'http://target-ds1.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 9, + type => 21, profile => 1, cdn_id => 1, - display_name => 'test-ds3-displayname', + ipv6_routing_enabled => 1, + protocol => 1, + display_name => 'target-ds1-displayname', initial_dispersion => 1, - geo_provider => 0, - regional_geo_blocking => 0, - ipv6_routing_enabled => 0, - logs_enabled => 0, + regional_geo_blocking => 1, }, }, - ## id => 11 - ds_cdn4 => { + ## id => 5 + target_ds2 => { new => 'Deliveryservice', using => { id => 11, - xml_id => 'test-ds4', + xml_id => 'steering-target-ds2', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => '', - dns_bypass_ip6 => '', - dns_bypass_ttl => -1, + dns_bypass_ip => 'hokeypokey', + dns_bypass_ttl => 10, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'test-ds4 long_desc', - long_desc_1 => 'test-ds4 long_desc_1', - long_desc_2 => 'test-ds4 long_desc_2', + long_desc => 'target-ds2 long_desc', + long_desc_1 => 'target-ds2 long_desc_1', + long_desc_2 => 'target-ds2 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://test-ds4.edge', - info_url => 'http://test-ds4.edge/info_url.html', + org_server_fqdn => 'http://target-ds2.edge', + info_url => 'http://target-ds2.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 9, + type => 21, profile => 1, cdn_id => 1, - display_name => 'test-ds4-displayname', + ipv6_routing_enabled => 1, + protocol => 1, + display_name => 'target-ds2-displayname', initial_dispersion => 1, - geo_provider => 0, - regional_geo_blocking => 0, - ipv6_routing_enabled => 0, - logs_enabled => 1, + regional_geo_blocking => 1, }, }, - ds_dns => { + ## id => 6 + target_ds3 => { new => 'Deliveryservice', using => { id => 12, - xml_id => 'test-ds5', + xml_id => 'steering-target-ds3', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => '', - dns_bypass_ip6 => '', - dns_bypass_ttl => -1, + dns_bypass_ip => 'hokeypokey', + dns_bypass_ttl => 10, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'test-ds5 long_desc', - long_desc_1 => 'test-ds5 long_desc_1', - long_desc_2 => 'test-ds5 long_desc_2', + long_desc => 'target-ds3 long_desc', + long_desc_1 => 'target-ds3 long_desc_1', + long_desc_2 => 'target-ds3 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://test-ds5.edge', - info_url => 'http://test-ds5.edge/info_url.html', + org_server_fqdn => 'http://target-ds3.edge', + info_url => 'http://target-ds3.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 7, - profile => 3, + type => 21, + profile => 1, cdn_id => 1, - display_name => 'test-ds5-displayname', + ipv6_routing_enabled => 1, + protocol => 1, + display_name => 'target-ds3-displayname', initial_dispersion => 1, - geo_provider => 0, - regional_geo_blocking => 0, - ipv6_routing_enabled => 0, - logs_enabled => 0, + regional_geo_blocking => 1, }, }, - ds_http_no_cache => { + ## id => 7 + target_ds4 => { new => 'Deliveryservice', using => { id => 13, - xml_id => 'test-ds6', + xml_id => 'steering-target-ds4', active => 1, dscp => 40, signed => 0, qstring_ignore => 0, geo_limit => 0, http_bypass_fqdn => '', - dns_bypass_ip => '', - dns_bypass_ip6 => '', - dns_bypass_ttl => -1, + dns_bypass_ip => 'hokeypokey', + dns_bypass_ttl => 10, ccr_dns_ttl => 3600, global_max_mbps => 0, global_max_tps => 0, - long_desc => 'test-ds6 long_desc', - long_desc_1 => 'test-ds6 long_desc_1', - long_desc_2 => 'test-ds6 long_desc_2', + long_desc => 'target-ds4 long_desc', + long_desc_1 => 'target-ds4 long_desc_1', + long_desc_2 => 'target-ds4 long_desc_2', max_dns_answers => 0, protocol => 0, - org_server_fqdn => 'http://test-ds6.edge', - info_url => 'http://test-ds6.edge/info_url.html', + org_server_fqdn => 'http://target-ds4.edge', + info_url => 'http://target-ds4.edge/info_url.html', miss_lat => '41.881944', miss_long => '-87.627778', check_path => '/crossdomain.xml', - type => 9, - profile => 3, + type => 21, + profile => 1, cdn_id => 1, - display_name => 'test-ds6-displayname', + ipv6_routing_enabled => 1, + protocol => 1, + display_name => 'target-ds4-displayname', initial_dispersion => 1, - geo_provider => 0, - regional_geo_blocking => 0, - ipv6_routing_enabled => 0, - logs_enabled => 0, + regional_geo_blocking => 1, }, }, ); diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm index 3266e35c86..7f61b8a597 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm @@ -21,43 +21,43 @@ my %definition_for = ( test_ds1_server_edge1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 8, + deliveryservice => 1, server => 1, }, }, test_ds1_server_edge13 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 8, - server => 3, + deliveryservice => 1, + server => 13, }, }, test_ds1_server_mid1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 8, - server => 4, + deliveryservice => 1, + server => 2, }, }, test_ds2_server_edge1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 9, - server => 2, + deliveryservice => 2, + server => 7, }, }, test_ds2_server_mid1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 9, - server => 5, + deliveryservice => 2, + server => 8, }, }, test_ds5_server_edge14 => { new => 'DeliveryserviceServer', using => { deliveryservice => 5, - server => 12, + server => 14, }, }, test_ds5_server_edge15 => { @@ -89,7 +89,8 @@ sub get_definition { } sub all_fixture_names { - return keys %definition_for; + # sort by db name to guarantee insertion order + return (sort { $definition_for{$a}{using}{deliveryservice} cmp $definition_for{$b}{using}{deliveryservice} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm index f6116bcca9..d27e93280f 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm @@ -21,22 +21,22 @@ my %definition_for = ( admin => { new => 'DeliveryserviceTmuser', using => { - deliveryservice => 8, + deliveryservice => 1, tm_user_id => 1, }, }, portal_ds1 => { new => 'DeliveryserviceTmuser', using => { - deliveryservice => 8, - tm_user_id => 5, + deliveryservice => 1, + tm_user_id => 2, }, }, ds_steering_user1 => { new => 'DeliveryserviceTmuser', using => { deliveryservice => 1, - tm_user_id => 6, + tm_user_id => 7, }, }, ds_steering_user2 => { diff --git a/traffic_ops/app/lib/Fixtures/TmUser.pm b/traffic_ops/app/lib/Fixtures/TmUser.pm index 6f70947401..4b18fa7586 100644 --- a/traffic_ops/app/lib/Fixtures/TmUser.pm +++ b/traffic_ops/app/lib/Fixtures/TmUser.pm @@ -22,12 +22,12 @@ use Digest::SHA1 qw(sha1_hex); my $local_passwd = sha1_hex('password'); my %definition_for = ( - ## id => 1 admin => { new => 'TmUser', using => { + id => 1, username => 'admin', - role => 1, + role => 4, uid => '1', gid => '1', local_passwd => $local_passwd, @@ -46,60 +46,60 @@ my %definition_for = ( registration_sent => '1999-01-01 00:00:00', }, }, - ## id => 2 - codebig => { + portal => { new => 'TmUser', using => { - username => 'codebig', + id => 2, + username => 'portal', role => 6, uid => '1', gid => '1', local_passwd => $local_passwd, confirm_local_passwd => $local_passwd, - full_name => 'The Codebig User', - email => 'codebig@kabletown.com', + full_name => 'The Portal User', + email => 'portal@kabletown.com', new_user => '1', - address_line1 => 'address_line7', - address_line2 => 'address_line8', + address_line1 => 'address_line3', + address_line2 => 'address_line4', city => 'city', state_or_province => 'state_or_province', - phone_number => '444-444-4444', - postal_code => '80124', + phone_number => '222-222-2222', + postal_code => '80122', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, - ## id => 3 - federation => { + codebig => { new => 'TmUser', using => { - username => 'federation', - role => 3, + id => 3, + username => 'codebig', + role => 6, uid => '1', gid => '1', local_passwd => $local_passwd, confirm_local_passwd => $local_passwd, - full_name => 'The federations User', - email => 'federation@kabletown.com', + full_name => 'The Codebig User', + email => 'codebig@kabletown.com', new_user => '1', - address_line1 => 'address_line1', - address_line2 => 'address_line2', + address_line1 => 'address_line7', + address_line2 => 'address_line8', city => 'city', state_or_province => 'state_or_province', - phone_number => '333-333-3333', - postal_code => '80123', + phone_number => '444-444-4444', + postal_code => '80124', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, - ## id => 4 migrations => { new => 'TmUser', using => { + id => 4, username => 'migration', - role => 4, + role => 5, uid => '1', gid => '1', local_passwd => $local_passwd, @@ -118,36 +118,36 @@ my %definition_for = ( registration_sent => '1999-01-01 00:00:00', }, }, - ## id => 5 - portal => { + federation => { new => 'TmUser', using => { - username => 'portal', - role => 6, + id => 5, + username => 'federation', + role => 7, uid => '1', gid => '1', local_passwd => $local_passwd, confirm_local_passwd => $local_passwd, - full_name => 'The Portal User', - email => 'portal@kabletown.com', + full_name => 'The federations User', + email => 'federation@kabletown.com', new_user => '1', - address_line1 => 'address_line3', - address_line2 => 'address_line4', + address_line1 => 'address_line1', + address_line2 => 'address_line2', city => 'city', state_or_province => 'state_or_province', - phone_number => '222-222-2222', - postal_code => '80122', + phone_number => '333-333-3333', + postal_code => '80123', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, - ## id => 6 steering1 => { new => 'TmUser', using => { + id => 6, username => 'steering1', - role => 8, + role => 7, uid => '1', gid => '1', local_passwd => $local_passwd, @@ -166,12 +166,12 @@ my %definition_for = ( registration_sent => '1999-01-01 00:00:00', }, }, - ## id => 7 steering2 => { new => 'TmUser', using => { + id => 7, username => 'steering2', - role => 8, + role => 7, uid => '1', gid => '1', local_passwd => $local_passwd, diff --git a/traffic_ops/app/t/api/1.1/deliveryserviceserver.t b/traffic_ops/app/t/api/1.1/deliveryserviceserver.t index 8a9af0e446..42fa37a683 100644 --- a/traffic_ops/app/t/api/1.1/deliveryserviceserver.t +++ b/traffic_ops/app/t/api/1.1/deliveryserviceserver.t @@ -42,7 +42,7 @@ ok $t->post_ok( '/login', => form => { u => 'portal', p => Test::TestHelper::ADM ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.1/deliveryserviceserver.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/server", "1" )->json_is( "/response/0/deliveryService", "8" )->json_is( "/limit", "20" ) + ->json_is( "/response/0/server", "1" )->json_is( "/response/0/deliveryService", "1" )->json_is( "/limit", "20" ) ->json_is( "/orderby", "deliveryservice" ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); From 06e3a5f4eff081a08a8f7f78a90a985c9252c5d4 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 10:37:27 -0700 Subject: [PATCH 04/38] realigned the ids so that the fixture ids are higher than the generated ones --- .../app/lib/Fixtures/Deliveryservice.pm | 30 +++-- .../app/lib/Fixtures/DeliveryserviceRegex.pm | 58 +++++----- .../app/lib/Fixtures/DeliveryserviceServer.pm | 18 +-- .../app/lib/Fixtures/DeliveryserviceTmuser.pm | 8 +- traffic_ops/app/lib/Fixtures/Division.pm | 3 +- traffic_ops/app/lib/Fixtures/Federation.pm | 10 +- .../lib/Fixtures/FederationDeliveryservice.pm | 8 +- .../app/lib/Fixtures/FederationResolver.pm | 18 +-- .../app/lib/Fixtures/FederationTmuser.pm | 9 +- traffic_ops/app/lib/Fixtures/Hwinfo.pm | 37 +++++- traffic_ops/app/lib/Fixtures/JobAgent.pm | 4 +- traffic_ops/app/lib/Fixtures/JobStatus.pm | 34 +++--- traffic_ops/app/lib/Fixtures/Log.pm | 4 +- traffic_ops/app/lib/Fixtures/Parameter.pm | 2 +- traffic_ops/app/lib/Fixtures/PhysLocation.pm | 36 +++--- traffic_ops/app/lib/Fixtures/Regex.pm | 26 ++--- traffic_ops/app/lib/Fixtures/Role.pm | 2 +- .../app/lib/Fixtures/Staticdnsentry.pm | 17 +-- .../app/lib/Fixtures/SteeringTarget.pm | 2 +- traffic_ops/app/lib/UI/DeliveryService.pm | 3 +- traffic_ops/app/t/deliveryservice.t | 106 ++++++++++-------- 21 files changed, 236 insertions(+), 199 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm index 7198e0100f..d9f5a34e09 100644 --- a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm +++ b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm @@ -22,7 +22,7 @@ my %definition_for = ( ds_cdn1 => { new => 'Deliveryservice', using => { - id => 1, + id => 100, xml_id => 'test-ds1', active => 1, dscp => 40, @@ -60,7 +60,7 @@ my %definition_for = ( ds_cdn2 => { new => 'Deliveryservice', using => { - id => 2, + id => 200, xml_id => 'test-ds2', active => 1, dscp => 40, @@ -98,7 +98,7 @@ my %definition_for = ( ds_cdn3 => { new => 'Deliveryservice', using => { - id => 3, + id => 300, xml_id => 'test-ds3', active => 1, dscp => 40, @@ -136,7 +136,7 @@ my %definition_for = ( ds_cdn4 => { new => 'Deliveryservice', using => { - id => 4, + id => 400, xml_id => 'test-ds4', active => 1, dscp => 40, @@ -174,7 +174,7 @@ my %definition_for = ( ds_dns => { new => 'Deliveryservice', using => { - id => 5, + id => 500, xml_id => 'test-ds5', active => 1, dscp => 40, @@ -212,7 +212,7 @@ my %definition_for = ( ds_http_no_cache => { new => 'Deliveryservice', using => { - id => 6, + id => 600, xml_id => 'test-ds6', active => 1, dscp => 40, @@ -250,7 +250,7 @@ my %definition_for = ( steering_ds1 => { new => 'Deliveryservice', using => { - id => 7, + id => 700, xml_id => 'steering-ds1', active => 1, dscp => 40, @@ -286,7 +286,7 @@ my %definition_for = ( steering_ds2 => { new => 'Deliveryservice', using => { - id => 8, + id => 800, xml_id => 'steering-ds2', active => 1, dscp => 40, @@ -322,7 +322,7 @@ my %definition_for = ( new_steering => { new => 'Deliveryservice', using => { - id => 9, + id => 900, xml_id => 'steering-ds3', active => 1, dscp => 40, @@ -355,11 +355,10 @@ my %definition_for = ( regional_geo_blocking => 1, }, }, - ## id => 4 target_ds1 => { new => 'Deliveryservice', using => { - id => 10, + id => 1000, xml_id => 'steering-target-ds1', active => 1, dscp => 40, @@ -392,11 +391,10 @@ my %definition_for = ( regional_geo_blocking => 1, }, }, - ## id => 5 target_ds2 => { new => 'Deliveryservice', using => { - id => 11, + id => 1100, xml_id => 'steering-target-ds2', active => 1, dscp => 40, @@ -429,11 +427,10 @@ my %definition_for = ( regional_geo_blocking => 1, }, }, - ## id => 6 target_ds3 => { new => 'Deliveryservice', using => { - id => 12, + id => 1200, xml_id => 'steering-target-ds3', active => 1, dscp => 40, @@ -466,11 +463,10 @@ my %definition_for = ( regional_geo_blocking => 1, }, }, - ## id => 7 target_ds4 => { new => 'Deliveryservice', using => { - id => 13, + id => 1300, xml_id => 'steering-target-ds4', active => 1, dscp => 40, diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceRegex.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceRegex.pm index f1716b14c7..16276368ee 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceRegex.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceRegex.pm @@ -18,107 +18,107 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - regex2 => { + regex1 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 9, - regex => 7, + deliveryservice => 100, + regex => 200, set_number => 0, }, }, - target_r1_filter => { + regex2 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 4, - regex => 1, + deliveryservice => 200, + regex => 100, set_number => 0, }, }, - regex1 => { + target_r1_filter => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 8, - regex => 5, + deliveryservice => 400, + regex => 100, set_number => 0, }, }, target_r2_filter => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 4, - regex => 2, + deliveryservice => 400, + regex => 200, set_number => 0, }, }, target_r4_filter => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 7, - regex => 3, + deliveryservice => 700, + regex => 300, set_number => 0, }, }, target_r3_filter => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 6, - regex => 4, + deliveryservice => 600, + regex => 400, set_number => 0, }, }, new_steering => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 3, - regex => 6, + deliveryservice => 300, + regex => 600, set_number => 0, }, }, steering_1 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 1, - regex => 8, + deliveryservice => 100, + regex => 800, set_number => 0, }, }, steering_2 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 2, - regex => 9, + deliveryservice => 200, + regex => 900, set_number => 0, }, }, target_1 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 4, - regex => 10, + deliveryservice => 400, + regex => 1000, set_number => 0, }, }, target_2 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 5, - regex => 11, + deliveryservice => 500, + regex => 1100, set_number => 0, }, }, target_3 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 6, - regex => 12, + deliveryservice => 600, + regex => 1200, set_number => 0, }, }, target_4 => { new => 'DeliveryserviceRegex', using => { - deliveryservice => 7, - regex => 13, + deliveryservice => 700, + regex => 1300, set_number => 0, }, }, diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm index 7f61b8a597..a5186021c0 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm @@ -21,63 +21,63 @@ my %definition_for = ( test_ds1_server_edge1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 1, + deliveryservice => 100, server => 1, }, }, test_ds1_server_edge13 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 1, + deliveryservice => 100, server => 13, }, }, test_ds1_server_mid1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 1, + deliveryservice => 100, server => 2, }, }, test_ds2_server_edge1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 2, + deliveryservice => 200, server => 7, }, }, test_ds2_server_mid1 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 2, + deliveryservice => 200, server => 8, }, }, test_ds5_server_edge14 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 5, + deliveryservice => 500, server => 14, }, }, test_ds5_server_edge15 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 5, + deliveryservice => 500, server => 15, }, }, test_ds6_server_edge14 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 6, + deliveryservice => 600, server => 14, }, }, test_ds6_server_edge15 => { new => 'DeliveryserviceServer', using => { - deliveryservice => 6, + deliveryservice => 600, server => 15, }, }, diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm index d27e93280f..2e03281aa8 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm @@ -21,28 +21,28 @@ my %definition_for = ( admin => { new => 'DeliveryserviceTmuser', using => { - deliveryservice => 1, + deliveryservice => 100, tm_user_id => 1, }, }, portal_ds1 => { new => 'DeliveryserviceTmuser', using => { - deliveryservice => 1, + deliveryservice => 100, tm_user_id => 2, }, }, ds_steering_user1 => { new => 'DeliveryserviceTmuser', using => { - deliveryservice => 1, + deliveryservice => 700, tm_user_id => 7, }, }, ds_steering_user2 => { new => 'DeliveryserviceTmuser', using => { - deliveryservice => 2, + deliveryservice => 800, tm_user_id => 7, }, }, diff --git a/traffic_ops/app/lib/Fixtures/Division.pm b/traffic_ops/app/lib/Fixtures/Division.pm index 984f55633e..5a1f8d5c01 100644 --- a/traffic_ops/app/lib/Fixtures/Division.pm +++ b/traffic_ops/app/lib/Fixtures/Division.pm @@ -22,6 +22,7 @@ my %definition_for = ( mountain => { new => 'Division', using => { + id => 1, name => 'mountain', }, }, @@ -34,7 +35,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Federation.pm b/traffic_ops/app/lib/Fixtures/Federation.pm index e5c8b7f966..788b81b4f4 100644 --- a/traffic_ops/app/lib/Fixtures/Federation.pm +++ b/traffic_ops/app/lib/Fixtures/Federation.pm @@ -21,37 +21,37 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - ## id => 1 name1 => { new => 'Federation', using => { + id => 1, cname => 'cname1.', description => 'resolver4 type', ttl => 86400, }, }, - ## id => 2 name2 => { new => 'Federation', using => { + id => 2, cname => 'cname2.', description => 'resolver4 type', ttl => 86400, }, }, - ## id => 3 name3 => { new => 'Federation', using => { + id => 3, cname => 'cname3.', description => 'resolver4 type', ttl => 86400, }, }, - ## id => 4 name4 => { new => 'Federation', using => { + id => 4, cname => 'cname4.', description => 'resolver4 type', ttl => 86400, @@ -66,7 +66,7 @@ sub get_definition { sub all_fixture_names { # sort by db cname to guarantee insertion order - return (sort { $definition_for{$a}{using}{cname} cmp $definition_for{$b}{using}{cname} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm b/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm index 6b1c810c5b..29a421e448 100644 --- a/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm +++ b/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm @@ -25,28 +25,28 @@ my %definition_for = ( new => 'FederationDeliveryservice', using => { federation => 1, - deliveryservice => 8, + deliveryservice => 1, }, }, federation_deliveryservice2 => { new => 'FederationDeliveryservice', using => { federation => 2, - deliveryservice => 9, + deliveryservice => 2, }, }, federation_deliveryservice3 => { new => 'FederationDeliveryservice', using => { federation => 3, - deliveryservice => 10, + deliveryservice => 3, }, }, federation_deliveryservice4 => { new => 'FederationDeliveryservice', using => { federation => 4, - deliveryservice => 11, + deliveryservice => 4, }, }, ); diff --git a/traffic_ops/app/lib/Fixtures/FederationResolver.pm b/traffic_ops/app/lib/Fixtures/FederationResolver.pm index 6e879f6133..9d0730f456 100644 --- a/traffic_ops/app/lib/Fixtures/FederationResolver.pm +++ b/traffic_ops/app/lib/Fixtures/FederationResolver.pm @@ -21,36 +21,36 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - ## id => 1 ipv4_resolver1 => { new => 'FederationResolver', using => { + id => 1, ip_address => "127.0.0.1/32", - type => 24, + type => 33, }, }, - ## id => 2 ipv4_resolver2 => { new => 'FederationResolver', using => { + id => 2, ip_address => "127.0.0.2/32", - type => 24, + type => 33, }, }, - ## id => 3 ipv6_resolver1 => { new => 'FederationResolver', using => { + id => 3, ip_address => "FE80::0202:B3FF:FE1E:8329/128", - type => 25, + type => 34, }, }, - ## id => 4 ipv6_resolver2 => { new => 'FederationResolver', using => { + id => 4, ip_address => "FE80::0202:B3FF:FE1E:8330/128", - type => 25, + type => 34, }, }, ); @@ -62,7 +62,7 @@ sub get_definition { sub all_fixture_names { # sort by db ip_address to guarantee insertion order - return (sort { $definition_for{$a}{using}{ip_address} cmp $definition_for{$b}{using}{ip_address} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/FederationTmuser.pm b/traffic_ops/app/lib/Fixtures/FederationTmuser.pm index 54f49992ad..a9d5f13e5c 100644 --- a/traffic_ops/app/lib/Fixtures/FederationTmuser.pm +++ b/traffic_ops/app/lib/Fixtures/FederationTmuser.pm @@ -25,20 +25,21 @@ my %definition_for = ( new => 'FederationTmuser', using => { federation => 1, - tm_user => 3, - role => 3, + tm_user => 5, + role => 7, }, }, federation_tm_user2 => { new => 'FederationTmuser', using => { federation => 2, - tm_user => 3, - role => 3, + tm_user => 5, + role => 7, }, } ); + sub get_definition { my ( $self, $name ) = @_; return $definition_for{$name}; diff --git a/traffic_ops/app/lib/Fixtures/Hwinfo.pm b/traffic_ops/app/lib/Fixtures/Hwinfo.pm index 4ba9cdb318..b9a24c2b18 100644 --- a/traffic_ops/app/lib/Fixtures/Hwinfo.pm +++ b/traffic_ops/app/lib/Fixtures/Hwinfo.pm @@ -19,24 +19,51 @@ use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my %definition_for = ( - ## id => 1 hw1 => { new => 'Hwinfo', using => { - serverid => 2, + id => 1, + serverid => 1, description => 'BACKPLANE FIRMWA', val => '7.0.0.29', }, }, - ## id => 2 hw2 => { new => 'Hwinfo', using => { - serverid => 4, + id => 2, + serverid => 2, description => 'DRAC FIRMWA', val => '1.0.0.29', }, - } + }, + hw3 => { + new => 'Hwinfo', + using => { + id => 3, + serverid => 2, + description => 'ServiceTag', + val => 'XXX', + }, + }, + hw4 => { + new => 'Hwinfo', + using => { + id => 4, + serverid => 2, + description => 'Manufacturer', + val => 'Dell Inc.', + }, + }, + hw5 => { + new => 'Hwinfo', + using => { + id => 5, + serverid => 2, + description => 'Model', + val => 'Beetle', + }, + }, ); sub get_definition { diff --git a/traffic_ops/app/lib/Fixtures/JobAgent.pm b/traffic_ops/app/lib/Fixtures/JobAgent.pm index 8ad3d7b2be..0fc224ebb5 100644 --- a/traffic_ops/app/lib/Fixtures/JobAgent.pm +++ b/traffic_ops/app/lib/Fixtures/JobAgent.pm @@ -18,10 +18,10 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 agent1 => { new => 'JobAgent', using => { + id => 1, name => 'agent1', description => 'Test Agent1' }, @@ -35,7 +35,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/JobStatus.pm b/traffic_ops/app/lib/Fixtures/JobStatus.pm index bb30cf63d7..5bab0c6bdb 100644 --- a/traffic_ops/app/lib/Fixtures/JobStatus.pm +++ b/traffic_ops/app/lib/Fixtures/JobStatus.pm @@ -18,36 +18,36 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 - cancelled => { + pending => { new => 'JobStatus', using => { - name => 'CANCELLED', - description => 'Job was cancelled' + id => 1, + name => 'PENDING', + description => 'Job is queued, but has not been picked up by any agents yet' }, }, - ## id => 2 - completed => { + in_progress => { new => 'JobStatus', using => { - name => 'COMPLETED', - description => 'Job has finished' + id => 2, + name => 'IN_PROGRESS', + description => 'Job is being processed by agents' }, }, - ## id => 3 - in_progress => { + completed => { new => 'JobStatus', using => { - name => 'IN_PROGRESS', - description => 'Job is being processed by agents' + id => 3, + name => 'COMPLETED', + description => 'Job has finished' }, }, - ## id => 4 - pending => { + cancelled => { new => 'JobStatus', using => { - name => 'PENDING', - description => 'Job is queued, but has not been picked up by any agents yet' + id => 4, + name => 'CANCELLED', + description => 'Job was cancelled' }, }, ); @@ -59,7 +59,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Log.pm b/traffic_ops/app/lib/Fixtures/Log.pm index cc2d5e1e9a..838a00baac 100644 --- a/traffic_ops/app/lib/Fixtures/Log.pm +++ b/traffic_ops/app/lib/Fixtures/Log.pm @@ -18,20 +18,20 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 message1 => { new => 'Log', using => { + id => 1, level => 'APICHANGE', ticketnum => 123, message => 'Message1', tm_user => 1, }, }, - ## id => 2 message2 => { new => 'Log', using => { + id => 2, level => 'APICHANGE', ticketnum => 456, message => 'Message2', diff --git a/traffic_ops/app/lib/Fixtures/Parameter.pm b/traffic_ops/app/lib/Fixtures/Parameter.pm index 3a07cb61b5..a3d18b0b99 100644 --- a/traffic_ops/app/lib/Fixtures/Parameter.pm +++ b/traffic_ops/app/lib/Fixtures/Parameter.pm @@ -587,7 +587,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { lc($definition_for{$a}{using}{id}) cmp lc($definition_for{$b}{using}{name}) } keys %definition_for); + return (sort { lc($definition_for{$a}{using}{id}) cmp lc($definition_for{$b}{using}{id}) } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/PhysLocation.pm b/traffic_ops/app/lib/Fixtures/PhysLocation.pm index 9f050556a8..e2026e1873 100644 --- a/traffic_ops/app/lib/Fixtures/PhysLocation.pm +++ b/traffic_ops/app/lib/Fixtures/PhysLocation.pm @@ -18,44 +18,44 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 - boulder => { + denver => { new => 'PhysLocation', using => { - name => 'Boulder', - short_name => 'boulder', - address => '1234 green way', - city => 'Boulder', + id => 1, + name => 'Denver', + short_name => 'denver', + address => '1234 mile high circle', + city => 'Denver', state => 'CO', - zip => '80301', + zip => '80202', poc => undef, - phone => '303-222-2222', + phone => '303-111-1111', email => undef, comments => undef, region => 1, }, }, - ## id => 2 - denver => { + boulder => { new => 'PhysLocation', using => { - name => 'Denver', - short_name => 'denver', - address => '1234 mile high circle', - city => 'Denver', + id => 2, + name => 'Boulder', + short_name => 'boulder', + address => '1234 green way', + city => 'Boulder', state => 'CO', - zip => '80202', + zip => '80301', poc => undef, - phone => '303-111-1111', + phone => '303-222-2222', email => undef, comments => undef, region => 1, }, }, - ## id => 3 atlanta => { new => 'PhysLocation', using => { + id => 3, name => 'HotAtlanta', short_name => 'atlanta', address => '1234 southern way', @@ -78,7 +78,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Regex.pm b/traffic_ops/app/lib/Fixtures/Regex.pm index abc2d946d3..b48b48e235 100644 --- a/traffic_ops/app/lib/Fixtures/Regex.pm +++ b/traffic_ops/app/lib/Fixtures/Regex.pm @@ -21,7 +21,7 @@ my %definition_for = ( regex_omg01 => { new => 'Regex', using => { - id => 1, + id => 100, pattern => '.*\.omg-01\..*', type => 19, }, @@ -29,7 +29,7 @@ my %definition_for = ( regex_1 => { new => 'Regex', using => { - id => 2, + id => 200, pattern => '.*\.foo\..*', type => 19, }, @@ -37,7 +37,7 @@ my %definition_for = ( target_filter_1 => { new => 'Regex', using => { - id => 3, + id => 300, pattern => '.*/force-to-one/.*', type => 20, }, @@ -45,7 +45,7 @@ my %definition_for = ( target_filter_1_2 => { new => 'Regex', using => { - id => 4, + id => 400, pattern => '.*/force-to-one-also/.*', type => 20, }, @@ -53,7 +53,7 @@ my %definition_for = ( target_filter_4 => { new => 'Regex', using => { - id => 5, + id => 500, pattern => '.*/go-to-four/.*', type => 20, }, @@ -61,7 +61,7 @@ my %definition_for = ( target_filter_3 => { new => 'Regex', using => { - id => 6, + id => 600, pattern => '.*/use-three/.*', type => 20, }, @@ -69,7 +69,7 @@ my %definition_for = ( hr_new_steering => { new => 'Regex', using => { - id => 7, + id => 700, pattern => '.*\.new-steering-ds\..*', type => 19, }, @@ -77,7 +77,7 @@ my %definition_for = ( hr_steering_1 => { new => 'Regex', using => { - id => 8, + id => 800, pattern => '.*\.steering-ds1\..*', type => 19, }, @@ -85,7 +85,7 @@ my %definition_for = ( hr_steering_2 => { new => 'Regex', using => { - id => 9, + id => 900, pattern => '.*\.steering-ds2\..*', type => 19, }, @@ -93,7 +93,7 @@ my %definition_for = ( hr_target_1 => { new => 'Regex', using => { - id => 10, + id => 1000, pattern => '.*\.target-ds1\..*', type => 19, }, @@ -101,7 +101,7 @@ my %definition_for = ( hr_target_2 => { new => 'Regex', using => { - id => 11, + id => 1100, pattern => '.*\.target-ds2\..*', type => 19, }, @@ -109,7 +109,7 @@ my %definition_for = ( hr_target_3 => { new => 'Regex', using => { - id => 12, + id => 1200, pattern => '.*\.target-ds3\..*', type => 19, }, @@ -117,7 +117,7 @@ my %definition_for = ( hr_target_4 => { new => 'Regex', using => { - id => 13, + id => 1300, pattern => '.*\.target-ds4\..*', type => 19, }, diff --git a/traffic_ops/app/lib/Fixtures/Role.pm b/traffic_ops/app/lib/Fixtures/Role.pm index 098748679b..c87dc5b857 100644 --- a/traffic_ops/app/lib/Fixtures/Role.pm +++ b/traffic_ops/app/lib/Fixtures/Role.pm @@ -100,7 +100,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm index d1c574f8bf..d43b2238a3 100644 --- a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm +++ b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm @@ -18,41 +18,42 @@ extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( - ## id => 1 a_record_host => { new => 'Staticdnsentry', using => { + id => 1, host => 'A_RECORD_HOST', address => '127.0.0.1', - type => 1, + type => 21, deliveryservice => 1, - cachegroup => 3, + cachegroup => 1, }, }, - ## id => 2 aaaa_record_host => { new => 'Staticdnsentry', using => { + id => 2, host => 'AAAA_RECORD_HOST', address => '127.0.0.1', deliveryservice => 1, cachegroup => 1, - type => 1, + type => 22, }, }, - ## id => 3 cname_host => { new => 'Staticdnsentry', using => { + id => 3, host => 'CNAME_HOST', address => '127.0.0.1', deliveryservice => 2, - type => 6, + type => 23, cachegroup => 2, }, }, ); + sub get_definition { my ( $self, $name ) = @_; return $definition_for{$name}; @@ -60,7 +61,7 @@ sub get_definition { sub all_fixture_names { # sort by db host to guarantee insertion order - return (sort { $definition_for{$a}{using}{host} cmp $definition_for{$b}{using}{host} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/SteeringTarget.pm b/traffic_ops/app/lib/Fixtures/SteeringTarget.pm index 6372493122..b24a6f17d5 100644 --- a/traffic_ops/app/lib/Fixtures/SteeringTarget.pm +++ b/traffic_ops/app/lib/Fixtures/SteeringTarget.pm @@ -30,7 +30,7 @@ my %definition_for = ( steering_target_1 => { new => 'SteeringTarget', using => { - deliveryservice => 1, + deliveryservice => 10, target => 4, weight => 1000, } diff --git a/traffic_ops/app/lib/UI/DeliveryService.pm b/traffic_ops/app/lib/UI/DeliveryService.pm index a3fce79846..089cfcf197 100644 --- a/traffic_ops/app/lib/UI/DeliveryService.pm +++ b/traffic_ops/app/lib/UI/DeliveryService.pm @@ -196,7 +196,7 @@ sub read { my $self = shift; my @data; my $orderby = "xml_id"; - $orderby = $self->param('orderby') if ( defined $self->param('orderby') ); + $orderby = $self->param('orderby') || 'id'; my $rs_data = $self->db->resultset("Deliveryservice")->search( undef, { prefetch => [ 'cdn', 'deliveryservice_regexes' ], @@ -219,6 +219,7 @@ sub read { } push( @data, { + "id" => $row->id, "xml_id" => $row->xml_id, "display_name" => $row->display_name, "dscp" => $row->dscp, diff --git a/traffic_ops/app/t/deliveryservice.t b/traffic_ops/app/t/deliveryservice.t index 48939cad62..9dacd0b7a6 100644 --- a/traffic_ops/app/t/deliveryservice.t +++ b/traffic_ops/app/t/deliveryservice.t @@ -31,8 +31,7 @@ BEGIN { $ENV{MOJO_MODE} = "test" } my $dbh = Schema->database_handle; my $schema = Schema->connect_to_database; my $t = Test::Mojo->new('TrafficOps'); -my $t3_id; - +my $t2_id; #unload data for a clean test Test::TestHelper->unload_core_data($schema); @@ -49,15 +48,6 @@ ok $t->post_ok( } )->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -#add - validate 200 response (data is actually added to DB when create is called) -ok $t->get_ok('/ds/add')->status_is(200), "validate add screen"; - -# validate existing delivery service -ok $t->get_ok('/ds/1')->status_is(200), "validate existing delivery service"; - -# validate existing delivery service -ok $t->get_ok('/ds/2')->status_is(200), "validate existing delivery service"; - # ####################### RW testing - careful with these! ##################################################### # create @@ -193,7 +183,7 @@ ok $t->post_ok( 'ds.qstring_ignore' => '1', 'ds.signed' => '1', 'ds.type' => '9', - 'ds.xml_id' => 'tst_xml_id_3', + 'ds.xml_id' => 'tst_xml_id_2', 'ds.protocol' => '0', 'ds.edge_header_rewrite' => '', 'ds.mid_header_rewrite' => '', @@ -211,27 +201,39 @@ ok $t->post_ok( 'ds.regional_geo_blocking' => '0', 'ds.geolimit_redirect_url' => 'http://knutsel3.com', } -)->status_is(302), "create HTTP_NO_CACHE deliveryservice"; +)->status_is(200), "create HTTP_NO_CACHE deliveryservice"; + +#add - validate 200 response (data is actually added to DB when create is called) +ok $t->get_ok('/ds/add')->status_is(200), "validate add screen"; + +# validate existing delivery service +ok $t->get_ok('/ds/1')->status_is(200), "validate existing delivery service"; + +# validate existing delivery service +ok $t->get_ok('/ds/1')->status_is(200), "validate existing delivery service"; #Validate create # Note the 4 is the index, not the id. #This can potentially make the tests fragile if more ds's are added to the fixtures... -ok $t->get_ok('/datadeliveryservice')->status_is(200) - ->json_is( '/4/xml_id' => 'steering-target-ds2' )->json_is( '/4/dscp' => '40' ) - ->json_is( '/4/active' => '1' )->json_is( '/4/protocol' => '1' ) - ->json_is( '/4/display_name' => 'target-ds2-displayname' ) - ->json_is( '/4/regional_geo_blocking' => '1' ) - ->json_is( '/0/regional_geo_blocking' => '1' ) - ->json_is( '/1/regional_geo_blocking' => '1' ), - "validate delivery services were created"; -$t3_id = &get_ds_id('tst_xml_id_3'); -ok defined($t3_id), "validated delivery service with all fields was added"; +ok $t->get_ok('/datadeliveryservice')-> + status_is(200)-> + json_is( '/0/dscp' => '40' ) + ->json_is( '/0/active' => '1' ) + ->json_is( '/0/protocol' => '3' ) + ->json_is( '/0/display_name' => 'display name 1' ) + ->json_is( '/0/regional_geo_blocking' => '1' ) + ->json_is( '/0/regional_geo_blocking' => '1' ) + ->json_is( '/1/regional_geo_blocking' => '0' ), + "validate delivery services were created"; + +$t2_id = &get_ds_id('tst_xml_id_2'); +ok defined($t2_id), "validated delivery service with all fields was added"; # update DS #post update ok $t->post_ok( - "/ds/$t3_id/update" => form => { + "/ds/$t2_id/update" => form => { 'ds.active' => '0', 'ds.ccr_dns_ttl' => '3601', 'ds.check_path' => '/clientaccesspolicy.xml_update', @@ -240,7 +242,7 @@ ok $t->post_ok( 'ds.dns_bypass_cname' => 'updateby.knutsel.com', 'ds.dns_bypass_ttl' => '31', 'ds.dscp' => '41', - 'ds.geo_limit' => '1', + 'ds.geo_limit' => '2', 'ds.geo_limit_countries' => '', 'ds.geo_provider' => '1', 'ds.global_max_mbps' => '4T', @@ -256,12 +258,12 @@ ok $t->post_ok( 'ds.org_server_fqdn' => 'http://update.knutsel.com', 'ds.multi_site_origin' => '0', 'ds.multi_site_origin_algorithm' => '0', - 'ds.profile' => '3', + 'ds.profile' => '2', 'ds.cdn_id' => '2', 'ds.qstring_ignore' => '0', 'ds.signed' => '0', 'ds.type' => '7', - 'ds.xml_id' => 'tst_xml_id_3_update', + 'ds.xml_id' => 'tst_xml_id_2', 'ds.protocol' => '1', 'ds.edge_header_rewrite' => '', 'ds.mid_header_rewrite' => '', @@ -286,30 +288,38 @@ ok $t->post_ok( #This can potentially make the tests fragile if more ds's are added to the fixtures... ok $t->get_ok('/datadeliveryservice')->status_is(200) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( '/6/dscp' => '40' )->json_is( '/6/active' => '1' ) - ->json_is( '/6/profile_description' => 'ccr description' ) - ->json_is( '/6/org_server_fqdn' => 'http://target-ds4.edge' ) - ->json_is( '/6/xml_id' => 'steering-target-ds4' ) - ->json_is( '/6/signed' => '0' )->json_is( '/6/qstring_ignore' => '0' ) - ->json_is( '/6/dns_bypass_ip' => 'hokeypokey' ) - ->json_is( '/6/dns_bypass_ttl' => '10' )->json_is( '/6/ccr_dns_ttl' => 3600 ) - ->json_is( '/6/global_max_mbps' => 0 ) - ->json_is( '/6/global_max_tps' => 0 )->json_is( '/6/miss_lat' => '41.881944' ) - ->json_is( '/6/miss_long' => '-87.627778' )->json_is( '/6/long_desc' => 'target-ds4 long_desc' ) - ->json_is( '/6/long_desc_1' => 'target-ds4 long_desc_1' ) - ->json_is( '/6/long_desc_2' => 'target-ds4 long_desc_2' ) - ->json_is( '/6/info_url' => 'http://target-ds4.edge/info_url.html' ) - ->json_is( '/6/protocol' => '1' )->json_is( '/6/profile_name' => 'CCR1' ) - ->json_is( '/6/display_name' => 'target-ds4-displayname' ) - ->json_is( '/6/regional_geo_blocking' => '1' ), + ->json_is( '/1/dscp' => '41' ) + ->json_is( '/1/active' => '0' ) + ->json_is( '/1/profile_description' => 'mid description' ) + ->json_is( '/1/org_server_fqdn' => 'http://update.knutsel.com' ) + ->json_is( '/1/xml_id' => 'tst_xml_id_2' ) + ->json_is( '/1/signed' => '0' ) + ->json_is( '/1/qstring_ignore' => '0' ) + ->json_is( '/1/dns_bypass_ip' => '10.10.10.11' ) + ->json_is( '/1/dns_bypass_ip6' => '2001:558:fee8:180::1/64' ) + ->json_is( '/1/dns_bypass_ttl' => '31' ) + ->json_is( '/1/ccr_dns_ttl' => 3601 ) + ->json_is( '/1/global_max_mbps' => 4000000 ) + ->json_is( '/1/global_max_tps' => 10001 ) + ->json_is( '/1/miss_lat' => '0' ) + ->json_is( '/1/miss_long' => '0' ) + ->json_is( '/1/long_desc' => 'long_update' ) + ->json_is( '/1/long_desc_1' => 'cust_update' ) + ->json_is( '/1/long_desc_2' => 'service_update' ) + ->json_is( '/1/info_url' => 'http://knutsel-update.com' ) + ->json_is( '/1/protocol' => '1' ) + ->json_is( '/1/profile_name' => 'MID1' ) + ->json_is( '/1/geolimit_redirect_url' => 'http://update.redirect.url.com' ) + ->json_is( '/1/display_name' => 'Testing Delivery Service' ) + ->json_is( '/1/regional_geo_blocking' => '1' ), "validate delivery service was updated"; #delete delivery service -# ok $t->get_ok("/ds/$t3_id/delete")->status_is(302), "delete ds"; -# -# #validate it was deleted -# $t3_id = &get_ds_id('tst_xml_id_3_update'); -# ok !defined($t3_id), "validated delivery service was deleted"; +ok $t->get_ok("/ds/$t2_id/delete")->status_is(302), "delete ds"; + +#validate it was deleted +$t2_id = &get_ds_id('tst_xml_id_2'); +ok !defined($t2_id), "validated delivery service was deleted"; sub get_ds_id { my $xml_id = shift; From a04a1e25368248231db74742741d7bd6b910b1ae Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 11:42:17 -0700 Subject: [PATCH 05/38] fixed the deliveryserviceserver fixtures, and test --- .../app/lib/Fixtures/DeliveryserviceServer.pm | 25 ++++++++----- traffic_ops/app/lib/Fixtures/Server.pm | 36 +++++++++---------- traffic_ops/app/t/deliveryserviceserver.t | 25 +++++++------ 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm index a5186021c0..64e45c610a 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceServer.pm @@ -22,63 +22,70 @@ my %definition_for = ( new => 'DeliveryserviceServer', using => { deliveryservice => 100, - server => 1, + server => 100, }, }, test_ds1_server_edge13 => { new => 'DeliveryserviceServer', using => { deliveryservice => 100, - server => 13, + server => 1300, }, }, test_ds1_server_mid1 => { new => 'DeliveryserviceServer', using => { deliveryservice => 100, - server => 2, + server => 300, }, }, test_ds2_server_edge1 => { new => 'DeliveryserviceServer', using => { deliveryservice => 200, - server => 7, + server => 700, }, }, test_ds2_server_mid1 => { new => 'DeliveryserviceServer', using => { deliveryservice => 200, - server => 8, + server => 800, }, }, test_ds5_server_edge14 => { new => 'DeliveryserviceServer', using => { deliveryservice => 500, - server => 14, + server => 1400, }, }, test_ds5_server_edge15 => { new => 'DeliveryserviceServer', using => { deliveryservice => 500, - server => 15, + server => 1500, }, }, test_ds6_server_edge14 => { new => 'DeliveryserviceServer', using => { deliveryservice => 600, - server => 14, + server => 1400, }, }, test_ds6_server_edge15 => { new => 'DeliveryserviceServer', using => { deliveryservice => 600, - server => 15, + server => 1500, + }, + }, + test_steering_ds1 => { + new => 'DeliveryserviceServer', + using => { + deliveryservice => 700, + server => 900, }, }, ); diff --git a/traffic_ops/app/lib/Fixtures/Server.pm b/traffic_ops/app/lib/Fixtures/Server.pm index 47348b94aa..24f0b34cd9 100644 --- a/traffic_ops/app/lib/Fixtures/Server.pm +++ b/traffic_ops/app/lib/Fixtures/Server.pm @@ -21,7 +21,7 @@ my %definition_for = ( server_edge1 => { new => 'Server', using => { - id => 1, + id => 100, host_name => 'atlanta-edge-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -56,7 +56,7 @@ my %definition_for = ( server_mid1 => { new => 'Server', using => { - id => 2, + id => 200, host_name => 'atlanta-mid-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -91,7 +91,7 @@ my %definition_for = ( rascal_server => { new => 'Server', using => { - id => 4, + id => 300, host_name => 'rascal01', domain_name => 'kabletown.net', tcp_port => 81, @@ -126,7 +126,7 @@ my %definition_for = ( riak_server1 => { new => 'Server', using => { - id => 5, + id => 400, host_name => 'riak01', domain_name => 'kabletown.net', tcp_port => 8088, @@ -161,7 +161,7 @@ my %definition_for = ( rascal_server2 => { new => 'Server', using => { - id => 6, + id => 500, host_name => 'rascal02', domain_name => 'kabletown.net', tcp_port => 81, @@ -196,7 +196,7 @@ my %definition_for = ( server_edge2 => { new => 'Server', using => { - id => 7, + id => 600, host_name => 'atlanta-edge-02', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -231,7 +231,7 @@ my %definition_for = ( server_mid2 => { new => 'Server', using => { - id => 8, + id => 700, host_name => 'atlanta-mid-02', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -266,7 +266,7 @@ my %definition_for = ( riak_server2 => { new => 'Server', using => { - id => 9, + id => 800, host_name => 'riak02', domain_name => 'kabletown.net', tcp_port => 8088, @@ -301,7 +301,7 @@ my %definition_for = ( influxdb_server1 => { new => 'Server', using => { - id => 10, + id => 900, host_name => 'influxdb01', domain_name => 'kabletown.net', tcp_port => 8086, @@ -336,7 +336,7 @@ my %definition_for = ( influxdb_server2 => { new => 'Server', using => { - id => 11, + id => 1000, host_name => 'influxdb02', domain_name => 'kabletown.net', tcp_port => 8086, @@ -371,7 +371,7 @@ my %definition_for = ( server_router => { new => 'Server', using => { - id => 12, + id => 1100, host_name => 'atlanta-router-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -406,7 +406,7 @@ my %definition_for = ( server_edge_reported => { new => 'Server', using => { - id => 13, + id => 1200, host_name => 'atlanta-edge-03', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -438,10 +438,10 @@ my %definition_for = ( phys_location => 1, }, }, - server_edge14 => { + server_edge13 => { new => 'Server', using => { - id => 14, + id => 1300, host_name => 'atlanta-edge-14', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -473,10 +473,10 @@ my %definition_for = ( phys_location => 1, }, }, - server_edge15 => { + server_edge14 => { new => 'Server', using => { - id => 15, + id => 1400, host_name => 'atlanta-edge-15', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, @@ -508,10 +508,10 @@ my %definition_for = ( phys_location => 1, }, }, - server_mid16 => { + server_mid15 => { new => 'Server', using => { - id => 16, + id => 1500, host_name => 'atlanta-mid-16', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, diff --git a/traffic_ops/app/t/deliveryserviceserver.t b/traffic_ops/app/t/deliveryserviceserver.t index 759840e9ac..c11ae4e0cd 100644 --- a/traffic_ops/app/t/deliveryserviceserver.t +++ b/traffic_ops/app/t/deliveryserviceserver.t @@ -44,41 +44,40 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ok $t->post_ok( '/create/dsserver', => form => { - server => '1', - deliveryservice => '2' + server => '100', + deliveryservice => '200' } )->status_is(302), "create deliveryservice_server"; # validate ds_server was created -ok $t->get_ok('/datadeliveryserviceserver')->status_is(200)->json_is( '/1/deliveryservice' => 'test-ds1' )->json_is( '/1/server' => '1' ), +ok $t->get_ok('/datadeliveryserviceserver')->status_is(200)->json_is( '/1/deliveryservice' => 'test-ds1' )->json_is( '/1/server' => '300' ), "validate deliveryservice_server was added"; # validate edit route -ok $t->get_ok('/dss/1/edit')->status_is(200), "validate edit screen"; +ok $t->get_ok('/dss/200/edit')->status_is(200), "validate edit screen"; #assign_servers ok $t->post_ok( - '/dss/1/update' => form => { - 'id' => '1', - 'serverid_2' => 'on', - 'serverid_1' => 'off' + '/dss/100/update' => form => { + 'serverid_200' => 'on', + 'serverid_100' => 'off' } )->status_is(302), "assign server to ds"; #clone_server ok $t->post_ok( - '/update/cpdss/2' => form => { - 'from_server' => '1', - 'to_server' => '2', + '/update/cpdss/200' => form => { + 'from_server' => '100', + 'to_server' => '200', } )->status_is(302), "clone server"; #validate clone -ok $t->get_ok('/datadeliveryserviceserver')->status_is(200)->json_is( '/1/deliveryservice' => 'steering-ds2' )->json_is( '/1/server' => '2' ), +ok $t->get_ok('/datadeliveryserviceserver')->status_is(200)->json_is( '/8/deliveryservice' => 'steering-ds1' )->json_is( '/8/server' => '900' ), "validate deliveryservice was cloned"; #validate cp dss view -ok $t->get_ok('/cpdssiframe/view/1')->status_is(200), "cpdss iframe"; +ok $t->get_ok('/cpdssiframe/view/100')->status_is(200), "cpdss iframe"; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); From e6596c91f27ea83dbbf5490fdd258f82f6f7063f Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 12:44:39 -0700 Subject: [PATCH 06/38] fixed the health.t testcase and data --- .../app/lib/Fixtures/FederationDeliveryservice.pm | 8 ++++---- traffic_ops/app/lib/Fixtures/Server.pm | 12 ++++++------ traffic_ops/app/lib/MojoPlugins/Health.pm | 2 ++ traffic_ops/app/t/deliveryservice.t | 2 +- traffic_ops/app/t/health.t | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm b/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm index 29a421e448..9a4eb3d903 100644 --- a/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm +++ b/traffic_ops/app/lib/Fixtures/FederationDeliveryservice.pm @@ -25,28 +25,28 @@ my %definition_for = ( new => 'FederationDeliveryservice', using => { federation => 1, - deliveryservice => 1, + deliveryservice => 100, }, }, federation_deliveryservice2 => { new => 'FederationDeliveryservice', using => { federation => 2, - deliveryservice => 2, + deliveryservice => 200, }, }, federation_deliveryservice3 => { new => 'FederationDeliveryservice', using => { federation => 3, - deliveryservice => 3, + deliveryservice => 300, }, }, federation_deliveryservice4 => { new => 'FederationDeliveryservice', using => { federation => 4, - deliveryservice => 4, + deliveryservice => 400, }, }, ); diff --git a/traffic_ops/app/lib/Fixtures/Server.pm b/traffic_ops/app/lib/Fixtures/Server.pm index 24f0b34cd9..3624a51074 100644 --- a/traffic_ops/app/lib/Fixtures/Server.pm +++ b/traffic_ops/app/lib/Fixtures/Server.pm @@ -115,10 +115,10 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 14, + type => 4, status => 2, - profile => 6, - cdn_id => 1, + profile => 3, + cdn_id => 2, cachegroup => 1, phys_location => 1, }, @@ -185,9 +185,9 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 14, + type => 4, status => 2, - profile => 7, + profile => 3, cdn_id => 2, cachegroup => 1, phys_location => 1, @@ -535,7 +535,7 @@ my %definition_for = ( ilo_password => '', router_host_name => '', router_port_name => '', - type => 1, + type => 2, status => 2, profile => 1, cdn_id => 1, diff --git a/traffic_ops/app/lib/MojoPlugins/Health.pm b/traffic_ops/app/lib/MojoPlugins/Health.pm index cd2eda8a5e..b06c33f178 100755 --- a/traffic_ops/app/lib/MojoPlugins/Health.pm +++ b/traffic_ops/app/lib/MojoPlugins/Health.pm @@ -50,6 +50,8 @@ sub register { ); while ( my $row = $rs_pp->next ) { + my $profile_name = $row->profile->name; + $self->app->log->debug("profile_name #-> " . Dumper($profile_name)); if ( $row->profile->name =~ m/^RASCAL/ ) { $rascal_profile = $row->profile->name; } diff --git a/traffic_ops/app/t/deliveryservice.t b/traffic_ops/app/t/deliveryservice.t index 9dacd0b7a6..b1d47a017b 100644 --- a/traffic_ops/app/t/deliveryservice.t +++ b/traffic_ops/app/t/deliveryservice.t @@ -149,7 +149,7 @@ ok $t->post_ok( 'ds.geolimit_redirect_url' => '', } )->status_is(302), "create DNS DeliveryService"; -my $t2_id = &get_ds_id('tst_xml_id_2'); +$t2_id = &get_ds_id('tst_xml_id_2'); ok defined($t2_id), "validated dns ds was added"; #create DS ALL FIELDS diff --git a/traffic_ops/app/t/health.t b/traffic_ops/app/t/health.t index bb9ac6a9d5..c60bd9cc9d 100644 --- a/traffic_ops/app/t/health.t +++ b/traffic_ops/app/t/health.t @@ -63,7 +63,7 @@ while ( my @row = $select->fetchrow_array ) { push( @{ $lines->{ $row[0] } }, @row ); } -$query = "select xml_id, global_max_mbps, global_max_tps from deliveryservice where active=1"; +$query = "select xml_id, global_max_mbps, global_max_tps from deliveryservice where active=true"; $select = $dbh->prepare($query); $select->execute(); my $ds; @@ -113,8 +113,8 @@ while ( my @row = $select->fetchrow_array ) { push( @{ $lines->{ $row[0] } }, @row ); } -$t->get_ok("/health/cdn1.json")->status_is(200)->json_is( "/profiles/MID/MID1/health.threshold.loadavg", "25.0" ) - ->json_is( "/profiles/MID/MID1/history.count", "30" )->json_is( "/deliveryServices/test-ds1/status", "REPORTED" ) +$t->get_ok("/health/cdn2.json")->status_is(200)->json_is( "/profiles/MID/MID1/health.threshold.loadavg", "25.0" ) + ->json_is( "/profiles/MID/MID1/history.count", "30" )->json_is( "/deliveryServices/test-ds5/status", "REPORTED" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); From c0ce7ba03c5c0e44b82f3d16ddb5c2df2dd6d649 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 12:52:42 -0700 Subject: [PATCH 07/38] more id realignment --- .../app/lib/Fixtures/DeliveryserviceTmuser.pm | 8 ++--- .../app/lib/Fixtures/FederationTmuser.pm | 4 +-- traffic_ops/app/lib/Fixtures/Hwinfo.pm | 10 +++---- traffic_ops/app/lib/Fixtures/PhysLocation.pm | 6 ++-- traffic_ops/app/lib/Fixtures/Server.pm | 30 +++++++++---------- traffic_ops/app/lib/Fixtures/TmUser.pm | 14 ++++----- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm b/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm index 2e03281aa8..38f909dc81 100644 --- a/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm +++ b/traffic_ops/app/lib/Fixtures/DeliveryserviceTmuser.pm @@ -22,28 +22,28 @@ my %definition_for = ( new => 'DeliveryserviceTmuser', using => { deliveryservice => 100, - tm_user_id => 1, + tm_user_id => 100, }, }, portal_ds1 => { new => 'DeliveryserviceTmuser', using => { deliveryservice => 100, - tm_user_id => 2, + tm_user_id => 200, }, }, ds_steering_user1 => { new => 'DeliveryserviceTmuser', using => { deliveryservice => 700, - tm_user_id => 7, + tm_user_id => 700, }, }, ds_steering_user2 => { new => 'DeliveryserviceTmuser', using => { deliveryservice => 800, - tm_user_id => 7, + tm_user_id => 700, }, }, ); diff --git a/traffic_ops/app/lib/Fixtures/FederationTmuser.pm b/traffic_ops/app/lib/Fixtures/FederationTmuser.pm index a9d5f13e5c..1789f5d595 100644 --- a/traffic_ops/app/lib/Fixtures/FederationTmuser.pm +++ b/traffic_ops/app/lib/Fixtures/FederationTmuser.pm @@ -25,7 +25,7 @@ my %definition_for = ( new => 'FederationTmuser', using => { federation => 1, - tm_user => 5, + tm_user => 500, role => 7, }, }, @@ -33,7 +33,7 @@ my %definition_for = ( new => 'FederationTmuser', using => { federation => 2, - tm_user => 5, + tm_user => 500, role => 7, }, } diff --git a/traffic_ops/app/lib/Fixtures/Hwinfo.pm b/traffic_ops/app/lib/Fixtures/Hwinfo.pm index b9a24c2b18..ed36cc4706 100644 --- a/traffic_ops/app/lib/Fixtures/Hwinfo.pm +++ b/traffic_ops/app/lib/Fixtures/Hwinfo.pm @@ -23,7 +23,7 @@ my %definition_for = ( new => 'Hwinfo', using => { id => 1, - serverid => 1, + serverid => 100, description => 'BACKPLANE FIRMWA', val => '7.0.0.29', }, @@ -32,7 +32,7 @@ my %definition_for = ( new => 'Hwinfo', using => { id => 2, - serverid => 2, + serverid => 200, description => 'DRAC FIRMWA', val => '1.0.0.29', }, @@ -41,7 +41,7 @@ my %definition_for = ( new => 'Hwinfo', using => { id => 3, - serverid => 2, + serverid => 200, description => 'ServiceTag', val => 'XXX', }, @@ -50,7 +50,7 @@ my %definition_for = ( new => 'Hwinfo', using => { id => 4, - serverid => 2, + serverid => 200, description => 'Manufacturer', val => 'Dell Inc.', }, @@ -59,7 +59,7 @@ my %definition_for = ( new => 'Hwinfo', using => { id => 5, - serverid => 2, + serverid => 200, description => 'Model', val => 'Beetle', }, diff --git a/traffic_ops/app/lib/Fixtures/PhysLocation.pm b/traffic_ops/app/lib/Fixtures/PhysLocation.pm index e2026e1873..914c9e491d 100644 --- a/traffic_ops/app/lib/Fixtures/PhysLocation.pm +++ b/traffic_ops/app/lib/Fixtures/PhysLocation.pm @@ -21,7 +21,7 @@ my %definition_for = ( denver => { new => 'PhysLocation', using => { - id => 1, + id => 100, name => 'Denver', short_name => 'denver', address => '1234 mile high circle', @@ -38,7 +38,7 @@ my %definition_for = ( boulder => { new => 'PhysLocation', using => { - id => 2, + id => 200, name => 'Boulder', short_name => 'boulder', address => '1234 green way', @@ -55,7 +55,7 @@ my %definition_for = ( atlanta => { new => 'PhysLocation', using => { - id => 3, + id => 300, name => 'HotAtlanta', short_name => 'atlanta', address => '1234 southern way', diff --git a/traffic_ops/app/lib/Fixtures/Server.pm b/traffic_ops/app/lib/Fixtures/Server.pm index 3624a51074..f69aa86d9c 100644 --- a/traffic_ops/app/lib/Fixtures/Server.pm +++ b/traffic_ops/app/lib/Fixtures/Server.pm @@ -50,7 +50,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 3, - phys_location => 1, + phys_location => 100, }, }, server_mid1 => { @@ -85,7 +85,7 @@ my %definition_for = ( profile => 2, cdn_id => 1, cachegroup => 1, - phys_location => 1, + phys_location => 100, }, }, rascal_server => { @@ -120,7 +120,7 @@ my %definition_for = ( profile => 3, cdn_id => 2, cachegroup => 1, - phys_location => 1, + phys_location => 100, }, }, riak_server1 => { @@ -155,7 +155,7 @@ my %definition_for = ( profile => 5, cdn_id => 1, cachegroup => 1, - phys_location => 1, + phys_location => 100, }, }, rascal_server2 => { @@ -190,7 +190,7 @@ my %definition_for = ( profile => 3, cdn_id => 2, cachegroup => 1, - phys_location => 1, + phys_location => 100, }, }, server_edge2 => { @@ -225,7 +225,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 3, - phys_location => 1, + phys_location => 100, }, }, server_mid2 => { @@ -260,7 +260,7 @@ my %definition_for = ( profile => 2, cdn_id => 2, cachegroup => 2, - phys_location => 2, + phys_location => 200, }, }, riak_server2 => { @@ -295,7 +295,7 @@ my %definition_for = ( profile => 5, cdn_id => 1, cachegroup => 1, - phys_location => 2, + phys_location => 200, }, }, influxdb_server1 => { @@ -330,7 +330,7 @@ my %definition_for = ( profile => 5, cdn_id => 1, cachegroup => 1, - phys_location => 3, + phys_location => 300, }, }, influxdb_server2 => { @@ -365,7 +365,7 @@ my %definition_for = ( profile => 5, cdn_id => 1, cachegroup => 1, - phys_location => 3, + phys_location => 300, }, }, server_router => { @@ -400,7 +400,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 3, - phys_location => 1, + phys_location => 100, }, }, server_edge_reported => { @@ -435,7 +435,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 3, - phys_location => 1, + phys_location => 100, }, }, server_edge13 => { @@ -470,7 +470,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 9, - phys_location => 1, + phys_location => 100, }, }, server_edge14 => { @@ -505,7 +505,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 9, - phys_location => 1, + phys_location => 100, }, }, server_mid15 => { @@ -540,7 +540,7 @@ my %definition_for = ( profile => 1, cdn_id => 1, cachegroup => 8, - phys_location => 1, + phys_location => 100, }, }, ); diff --git a/traffic_ops/app/lib/Fixtures/TmUser.pm b/traffic_ops/app/lib/Fixtures/TmUser.pm index 4b18fa7586..eee798606d 100644 --- a/traffic_ops/app/lib/Fixtures/TmUser.pm +++ b/traffic_ops/app/lib/Fixtures/TmUser.pm @@ -25,7 +25,7 @@ my %definition_for = ( admin => { new => 'TmUser', using => { - id => 1, + id => 100, username => 'admin', role => 4, uid => '1', @@ -49,7 +49,7 @@ my %definition_for = ( portal => { new => 'TmUser', using => { - id => 2, + id => 200, username => 'portal', role => 6, uid => '1', @@ -73,7 +73,7 @@ my %definition_for = ( codebig => { new => 'TmUser', using => { - id => 3, + id => 300, username => 'codebig', role => 6, uid => '1', @@ -97,7 +97,7 @@ my %definition_for = ( migrations => { new => 'TmUser', using => { - id => 4, + id => 400, username => 'migration', role => 5, uid => '1', @@ -121,7 +121,7 @@ my %definition_for = ( federation => { new => 'TmUser', using => { - id => 5, + id => 500, username => 'federation', role => 7, uid => '1', @@ -145,7 +145,7 @@ my %definition_for = ( steering1 => { new => 'TmUser', using => { - id => 6, + id => 600, username => 'steering1', role => 7, uid => '1', @@ -169,7 +169,7 @@ my %definition_for = ( steering2 => { new => 'TmUser', using => { - id => 7, + id => 700, username => 'steering2', role => 7, uid => '1', From 7aea7702d04e9c06d8ec42e199a2fcfe2b9d36fe Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:17:48 -0700 Subject: [PATCH 08/38] fixed data alignment and t/staticdnsentry.t --- .../app/lib/Fixtures/Deliveryservice.pm | 26 +- traffic_ops/app/lib/Fixtures/Profile.pm | 12 +- .../app/lib/Fixtures/ProfileParameter.pm | 238 +++++++++--------- traffic_ops/app/lib/Fixtures/Server.pm | 30 +-- .../app/lib/Fixtures/Staticdnsentry.pm | 10 +- traffic_ops/app/t/deliveryservice.t | 8 +- traffic_ops/app/t/purge.t | 4 +- traffic_ops/app/t/server.t | 10 +- traffic_ops/app/t/staticdnsentry.t | 2 +- 9 files changed, 170 insertions(+), 170 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm index d9f5a34e09..290c211121 100644 --- a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm +++ b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm @@ -47,7 +47,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -85,7 +85,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 9, - profile => 1, + profile => 100, cdn_id => 1, display_name => 'test-ds2-displayname', initial_dispersion => 1, @@ -123,7 +123,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 9, - profile => 1, + profile => 100, cdn_id => 1, display_name => 'test-ds3-displayname', initial_dispersion => 1, @@ -161,7 +161,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 9, - profile => 1, + profile => 100, cdn_id => 1, display_name => 'test-ds4-displayname', initial_dispersion => 1, @@ -199,7 +199,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 7, - profile => 3, + profile => 300, cdn_id => 1, display_name => 'test-ds5-displayname', initial_dispersion => 1, @@ -237,7 +237,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 9, - profile => 3, + profile => 300, cdn_id => 1, display_name => 'test-ds6-displayname', initial_dispersion => 1, @@ -274,7 +274,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -310,7 +310,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -346,7 +346,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -382,7 +382,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -418,7 +418,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -454,7 +454,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, @@ -490,7 +490,7 @@ my %definition_for = ( miss_long => '-87.627778', check_path => '/crossdomain.xml', type => 21, - profile => 1, + profile => 100, cdn_id => 1, ipv6_routing_enabled => 1, protocol => 1, diff --git a/traffic_ops/app/lib/Fixtures/Profile.pm b/traffic_ops/app/lib/Fixtures/Profile.pm index f4765b3abc..4a46b6f741 100644 --- a/traffic_ops/app/lib/Fixtures/Profile.pm +++ b/traffic_ops/app/lib/Fixtures/Profile.pm @@ -21,7 +21,7 @@ my %definition_for = ( EDGE1 => { new => 'Profile', using => { - id => 1, + id => 100, name => 'EDGE1', description => 'edge description', }, @@ -29,7 +29,7 @@ my %definition_for = ( MID1 => { new => 'Profile', using => { - id => 2, + id => 200, name => 'MID1', description => 'mid description', }, @@ -37,7 +37,7 @@ my %definition_for = ( CCR1 => { new => 'Profile', using => { - id => 3, + id => 300, name => 'CCR1', description => 'ccr description', }, @@ -45,7 +45,7 @@ my %definition_for = ( RIAK1 => { new => 'Profile', using => { - id => 5, + id => 500, name => 'RIAK1', description => 'riak description', }, @@ -53,7 +53,7 @@ my %definition_for = ( RASCAL1 => { new => 'Profile', using => { - id => 6, + id => 600, name => 'RASCAL1', description => 'rascal description', }, @@ -61,7 +61,7 @@ my %definition_for = ( RASCAL2 => { new => 'Profile', using => { - id => 7, + id => 700, name => 'RASCAL2', description => 'rascal2 description', }, diff --git a/traffic_ops/app/lib/Fixtures/ProfileParameter.pm b/traffic_ops/app/lib/Fixtures/ProfileParameter.pm index e5a306ebee..e2503ee110 100644 --- a/traffic_ops/app/lib/Fixtures/ProfileParameter.pm +++ b/traffic_ops/app/lib/Fixtures/ProfileParameter.pm @@ -22,833 +22,833 @@ my %definition_for = ( domain_name => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 3, }, }, domain_name2 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 3, }, }, domain_name3 => { new => 'ProfileParameter', using => { - profile => 3, + profile => 300, parameter => 3, }, }, domain_name5 => { new => 'ProfileParameter', using => { - profile => 5, + profile => 500, parameter => 3, }, }, domain_name6 => { new => 'ProfileParameter', using => { - profile => 6, + profile => 600, parameter => 3, }, }, domain_name7 => { new => 'ProfileParameter', using => { - profile => 7, + profile => 700, parameter => 3, }, }, rascal_properties1 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 4, }, }, rascal_properties2 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 5, }, }, rascal_properties2 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 6, }, }, edge1_key0 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 7, }, }, edge1_key1 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 8, }, }, edge1_key2 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 9, }, }, edge1_key3 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 10, }, }, edge1_key4 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 11, }, }, edge1_key5 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 12, }, }, edge1_key6 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 13, }, }, edge1_key7 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 14, }, }, edge1_key8 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 15, }, }, edge1_key9 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 16, }, }, edge1_key10 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 17, }, }, edge1_key11 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 18, }, }, edge1_key12 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 19, }, }, edge1_key13 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 20, }, }, edge1_key14 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 21, }, }, edge1_key15 => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 22, }, }, 'edge1_url_sig_cdl-c2.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 23, }, }, 'edge1_error_url' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 24, }, }, 'edge1_CONFIG-proxy.config.allocator.debug_filter' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 25, }, }, 'edge1_CONFIG-proxy.config.allocator.enable_reclaim' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 26, }, }, 'edge1_CONFIG-proxy.config.allocator.max_overage' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 27, }, }, 'edge1_CONFIG-proxy.config.diags.show_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 28, }, }, 'edge1_CONFIG-proxy.config.http.cache.allow_empty_doc' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 29, }, }, 'LOCAL-proxy.config.cache.interim.storage' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 30, }, }, 'edge1_CONFIG-proxy.config.http.parent_proxy.file' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 31, }, }, 'edge1_12M_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 32, }, }, 'edge1_cacheurl_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 33, }, }, 'edge1_ip_allow_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 34, }, }, 'edge1_astats_over_http.so' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 35, }, }, 'edge1_crontab_root_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 36, }, }, 'edge1_hdr_rw_cdl-c2.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 37, }, }, 'edge1_50-ats.rules_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 38, }, }, 'edge1_parent.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 39, }, }, 'edge1_remap.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 40, }, }, 'edge1_drop_qstring.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 41, }, }, 'edge1_LogFormat.Format' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 42, }, }, 'edge1_LogFormat.Name' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 43, }, }, 'edge1_LogObject.Format' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 44, }, }, 'edge1_LogObject.Filename' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 45, }, }, 'edge1_cache.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 46, }, }, 'edge1_CONFIG-proxy.config.cache.control.filename' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 47, }, }, 'edge1_regex_revalidate.so' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 48, }, }, 'edge1_regex_revalidate.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 49, }, }, 'edge1_hosting.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 50, }, }, 'edge1_volume.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 51, }, }, 'edge1_allow_ip' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 52, }, }, 'edge1_allow_ip6' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 53, }, }, 'edge1_record_types' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 54, }, }, 'edge1_astats.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 55, }, }, 'edge1_astats.config_path' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 56, }, }, 'edge1_storage.config_location' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 57, }, }, 'edge1_Drive_Prefix' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 58, }, }, 'edge1_Drive_Letters' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 59, }, }, 'edge1_Disk_Volume' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 60, }, }, 'edge1_CONFIG-proxy.config.hostdb.storage_size' => { new => 'ProfileParameter', using => { - profile => 1, + profile => 100, parameter => 61, }, }, mid1_key0 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 7, }, }, mid1_key1 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 8, }, }, mid1_key2 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 9, }, }, mid1_key3 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 10, }, }, mid1_key4 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 11, }, }, mid1_key5 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 12, }, }, mid1_key6 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 13, }, }, mid1_key7 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 14, }, }, mid1_key8 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 15, }, }, mid1_key9 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 16, }, }, mid1_key10 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 17, }, }, mid1_key11 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 18, }, }, mid1_key12 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 19, }, }, mid1_key13 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 20, }, }, mid1_key14 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 21, }, }, mid1_key15 => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 22, }, }, 'mid1_url_sig_cdl-c2.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 23, }, }, 'mid1_error_url' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 24, }, }, 'mid1_CONFIG-proxy.config.allocator.debug_filter' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 25, }, }, 'mid1_CONFIG-proxy.config.allocator.enable_reclaim' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 26, }, }, 'mid1_CONFIG-proxy.config.allocator.max_overage' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 27, }, }, 'mid1_CONFIG-proxy.config.diags.show_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 28, }, }, 'mid1_CONFIG-proxy.config.http.cache.allow_empty_doc' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 29, }, }, 'LOCAL-proxy.config.cache.interim.storage' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 30, }, }, 'mid1_CONFIG-proxy.config.http.parent_proxy.file' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 31, }, }, 'mid1_12M_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 32, }, }, 'mid1_cacheurl_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 33, }, }, 'mid1_ip_allow_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 34, }, }, 'mid1_astats_over_http.so' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 35, }, }, 'mid1_crontab_root_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 36, }, }, 'mid1_hdr_rw_cdl-c2.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 37, }, }, 'mid1_50-ats.rules_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 38, }, }, 'mid1_parent.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 39, }, }, 'mid1_remap.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 40, }, }, 'mid1_drop_qstring.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 41, }, }, 'mid1_LogFormat.Format' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 42, }, }, 'mid1_LogFormat.Name' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 43, }, }, 'mid1_LogObject.Format' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 44, }, }, 'mid1_LogObject.Filename' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 45, }, }, 'mid1_cache.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 46, }, }, 'mid1_CONFIG-proxy.config.cache.control.filename' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 47, }, }, 'mid1_regex_revalidate.so' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 48, }, }, 'mid1_regex_revalidate.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 49, }, }, 'mid1_hosting.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 50, }, }, 'mid1_volume.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 51, }, }, 'mid1_allow_ip' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 52, }, }, 'mid1_allow_ip6' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 53, }, }, 'mid1_record_types' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 54, }, }, 'mid1_astats.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 55, }, }, 'mid1_astats.config_path' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 56, }, }, 'mid1_storage.config_location' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 57, }, }, 'mid1_Drive_Prefix' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 58, }, }, 'mid1_Drive_Letters' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 59, }, }, 'mid1_Disk_Volume' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 60, }, }, 'mid1_CONFIG-proxy.config.hostdb.storage_size' => { new => 'ProfileParameter', using => { - profile => 2, + profile => 200, parameter => 61, }, }, diff --git a/traffic_ops/app/lib/Fixtures/Server.pm b/traffic_ops/app/lib/Fixtures/Server.pm index f69aa86d9c..cf0e5d5007 100644 --- a/traffic_ops/app/lib/Fixtures/Server.pm +++ b/traffic_ops/app/lib/Fixtures/Server.pm @@ -47,7 +47,7 @@ my %definition_for = ( router_port_name => '', type => 1, status => 2, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 3, phys_location => 100, @@ -82,7 +82,7 @@ my %definition_for = ( router_port_name => '', type => 2, status => 2, - profile => 2, + profile => 200, cdn_id => 1, cachegroup => 1, phys_location => 100, @@ -117,7 +117,7 @@ my %definition_for = ( router_port_name => '', type => 4, status => 2, - profile => 3, + profile => 300, cdn_id => 2, cachegroup => 1, phys_location => 100, @@ -152,7 +152,7 @@ my %definition_for = ( router_port_name => '', type => 31, status => 2, - profile => 5, + profile => 500, cdn_id => 1, cachegroup => 1, phys_location => 100, @@ -187,7 +187,7 @@ my %definition_for = ( router_port_name => '', type => 4, status => 2, - profile => 3, + profile => 300, cdn_id => 2, cachegroup => 1, phys_location => 100, @@ -222,7 +222,7 @@ my %definition_for = ( router_port_name => '', type => 1, status => 2, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 3, phys_location => 100, @@ -257,7 +257,7 @@ my %definition_for = ( router_port_name => '', type => 2, status => 2, - profile => 2, + profile => 200, cdn_id => 2, cachegroup => 2, phys_location => 200, @@ -292,7 +292,7 @@ my %definition_for = ( router_port_name => '', type => 31, status => 2, - profile => 5, + profile => 500, cdn_id => 1, cachegroup => 1, phys_location => 200, @@ -327,7 +327,7 @@ my %definition_for = ( router_port_name => '', type => 32, status => 2, - profile => 5, + profile => 500, cdn_id => 1, cachegroup => 1, phys_location => 300, @@ -362,7 +362,7 @@ my %definition_for = ( router_port_name => '', type => 32, status => 2, - profile => 5, + profile => 500, cdn_id => 1, cachegroup => 1, phys_location => 300, @@ -397,7 +397,7 @@ my %definition_for = ( router_port_name => '', type => 4, status => 2, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 3, phys_location => 100, @@ -432,7 +432,7 @@ my %definition_for = ( router_port_name => '', type => 1, status => 3, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 3, phys_location => 100, @@ -467,7 +467,7 @@ my %definition_for = ( router_port_name => '', type => 1, status => 2, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 9, phys_location => 100, @@ -502,7 +502,7 @@ my %definition_for = ( router_port_name => '', type => 1, status => 2, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 9, phys_location => 100, @@ -537,7 +537,7 @@ my %definition_for = ( router_port_name => '', type => 2, status => 2, - profile => 1, + profile => 100, cdn_id => 1, cachegroup => 8, phys_location => 100, diff --git a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm index d43b2238a3..d7866d662d 100644 --- a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm +++ b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm @@ -21,7 +21,7 @@ my %definition_for = ( a_record_host => { new => 'Staticdnsentry', using => { - id => 1, + id => 100, host => 'A_RECORD_HOST', address => '127.0.0.1', type => 21, @@ -32,10 +32,10 @@ my %definition_for = ( aaaa_record_host => { new => 'Staticdnsentry', using => { - id => 2, + id => 200, host => 'AAAA_RECORD_HOST', address => '127.0.0.1', - deliveryservice => 1, + deliveryservice => 100, cachegroup => 1, type => 22, }, @@ -43,10 +43,10 @@ my %definition_for = ( cname_host => { new => 'Staticdnsentry', using => { - id => 3, + id => 300, host => 'CNAME_HOST', address => '127.0.0.1', - deliveryservice => 2, + deliveryservice => 200, type => 23, cachegroup => 2, }, diff --git a/traffic_ops/app/t/deliveryservice.t b/traffic_ops/app/t/deliveryservice.t index b1d47a017b..e41894597b 100644 --- a/traffic_ops/app/t/deliveryservice.t +++ b/traffic_ops/app/t/deliveryservice.t @@ -78,7 +78,7 @@ ok $t->post_ok( 'ds.org_server_fqdn' => 'http://jvd.knutsel.com', 'ds.multi_site_origin' => '0', 'ds.multi_site_origin_algorithm' => '0', - 'ds.profile' => '1', + 'ds.profile' => '100', 'ds.cdn_id' => '1', 'ds.qstring_ignore' => '0', 're_order_0' => '0', @@ -128,7 +128,7 @@ ok $t->post_ok( 'ds.org_server_fqdn' => 'http://jvd-1.knutsel.com', 'ds.multi_site_origin' => '0', 'ds.multi_site_origin_algorithm' => '0', - 'ds.profile' => '1', + 'ds.profile' => '100', 'ds.cdn_id' => '1', 'ds.qstring_ignore' => '0', 'ds.signed' => '0', @@ -178,7 +178,7 @@ ok $t->post_ok( 'ds.org_server_fqdn' => 'http://jvd.knutsel.com', 'ds.multi_site_origin' => '0', 'ds.multi_site_origin_algorithm' => '0', - 'ds.profile' => '1', + 'ds.profile' => '100', 'ds.cdn_id' => '1', 'ds.qstring_ignore' => '1', 'ds.signed' => '1', @@ -258,7 +258,7 @@ ok $t->post_ok( 'ds.org_server_fqdn' => 'http://update.knutsel.com', 'ds.multi_site_origin' => '0', 'ds.multi_site_origin_algorithm' => '0', - 'ds.profile' => '2', + 'ds.profile' => '200', 'ds.cdn_id' => '2', 'ds.qstring_ignore' => '0', 'ds.signed' => '0', diff --git a/traffic_ops/app/t/purge.t b/traffic_ops/app/t/purge.t index a74e2afe6d..cd43a7fc71 100644 --- a/traffic_ops/app/t/purge.t +++ b/traffic_ops/app/t/purge.t @@ -46,7 +46,7 @@ ok $schema->resultset('Profile')->find( { name => 'EDGE1' } ), 'Profile edge1 ex ok $schema->resultset('Deliveryservice')->find( { xml_id => 'test-ds1' } ), 'Deliveryservice test-ds1 exists?'; $t->post_ok( '/login', => form => { u => 'admin', p => 'password' } )->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -my $q = 'SELECT deliveryservice.id, +my $q = "SELECT deliveryservice.id, deliveryservice.xml_id, org_server_fqdn, type, @@ -55,7 +55,7 @@ my $q = 'SELECT deliveryservice.id, FROM deliveryservice JOIN profile ON profile.id = deliveryservice.profile JOIN cdn ON cdn.id = deliveryservice.cdn_id - WHERE deliveryservice.active = 1 ORDER BY RANDOM() LIMIT 1'; + WHERE deliveryservice.active = 'true' ORDER BY RANDOM() LIMIT 1"; my $get_ds = $dbh->prepare($q); $get_ds->execute(); diff --git a/traffic_ops/app/t/server.t b/traffic_ops/app/t/server.t index e18ead49e0..069d50a86a 100644 --- a/traffic_ops/app/t/server.t +++ b/traffic_ops/app/t/server.t @@ -41,7 +41,7 @@ Test::TestHelper->unload_core_data($schema); #load core test data Test::TestHelper->load_core_data($schema); -my $q = 'select * from server where type = 18 limit 1'; +my $q = 'select * from server where type = 1 limit 1'; my $get_servers = $dbh->prepare($q); $get_servers->execute(); my $svr = $get_servers->fetchall_arrayref( {} ); @@ -116,10 +116,10 @@ $t->post_ok( ip6_address => '2009:334:333::2/64', ip6_gateway => '2009:334:333::1', interface_mtu => '9000', - phys_location => 1, + phys_location => 100, cachegroup => 1, type => 1, - profile => 1, + profile => 100, cdn => 1, mgmt_ip_address => '192.168.1.1', mgmt_ip_gateway => '192.168.1.2', @@ -161,10 +161,10 @@ sub upd_and_del() { ip6_address => '2009:334:333::2/64', ip6_gateway => '2009:334:333::1', interface_mtu => '9000', - phys_location => 1, + phys_location => 100, cachegroup => 1, type => 1, - profile => 1, + profile => 100, cdn_id => 1, mgmt_ip_address => '192.168.3.1', mgmt_ip_netmask => '192.168.3.2', diff --git a/traffic_ops/app/t/staticdnsentry.t b/traffic_ops/app/t/staticdnsentry.t index 54837be651..ca64d0aed9 100644 --- a/traffic_ops/app/t/staticdnsentry.t +++ b/traffic_ops/app/t/staticdnsentry.t @@ -39,7 +39,7 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ####################### RW testing - careful with these! ##################################################### #these ids are created by fixtures, so we know them. -my $dsid = 1; +my $dsid = 100; my $atypeid = 20; my $locid = 1; From 671357390819d79338e83a543ed91112ce1fcd92 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:23:17 -0700 Subject: [PATCH 09/38] removed because the type ids are incorrect --- traffic_ops/app/t/status.t | 88 -------------------------------------- traffic_ops/app/t/types.t | 82 ----------------------------------- 2 files changed, 170 deletions(-) delete mode 100644 traffic_ops/app/t/status.t delete mode 100644 traffic_ops/app/t/types.t diff --git a/traffic_ops/app/t/status.t b/traffic_ops/app/t/status.t deleted file mode 100644 index d82c52752a..0000000000 --- a/traffic_ops/app/t/status.t +++ /dev/null @@ -1,88 +0,0 @@ -package main; -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use Mojo::Base -strict; -use Test::More; -use Test::Mojo; -use DBI; -use strict; -use warnings; -no warnings 'once'; -use warnings 'all'; -use Test::TestHelper; - -#no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! -#no_transactions=>0 ==> delete fixtures after every execution - -BEGIN { $ENV{MOJO_MODE} = "test" } - -my $schema = Schema->connect_to_database; -my $dbh = Schema->database_handle; -my $t = Test::Mojo->new('TrafficOps'); - -Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); - -ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -my $q = 'select * from status limit 1'; -my $get_ds = $dbh->prepare($q); -$get_ds->execute(); -my $p = $get_ds->fetchall_arrayref( {} ); -$get_ds->finish(); - -# the jsons -# Note the 3 is the index in the array returned, not the id. It's safe to assume there are at least 3 statuses. -$t->get_ok('/datastatus')->status_is(200)->json_has('/3/name')->json_has('/3/description'); - -#clean up old crud -&upd_and_del(); - -# create a new param -$t->post_ok( - '/status/create' => form => { - name => 'JLP_TEST_STATUS', - description => 'This is a test status' - - } -)->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -# modify and delete it -&upd_and_del(); - -sub upd_and_del() { - my $q = 'select id from status where name = \'JLP_TEST_STATUS\''; - my $get_ds = $dbh->prepare($q); - $get_ds->execute(); - my $p = $get_ds->fetchall_arrayref( {} ); - $get_ds->finish(); - my $i = 0; - while ( defined( $p->[$i] ) ) { - my $id = $p->[$i]->{id}; - $t->post_ok( - '/status/update/' - . $id => form => { - name => 'JLP_TEST_STATUS', - description => 'This is a test status' - } - )->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - $t->get_ok( '/status/delete/' . $id )->status_is(302); - $i++; - } -} -ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -$dbh->disconnect(); -done_testing(); diff --git a/traffic_ops/app/t/types.t b/traffic_ops/app/t/types.t deleted file mode 100644 index a455bb9425..0000000000 --- a/traffic_ops/app/t/types.t +++ /dev/null @@ -1,82 +0,0 @@ -package main; -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use Mojo::Base -strict; -use Test::More; -use Test::Mojo; -use DBI; -use strict; -use warnings; -use Test::TestHelper; - -#no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! -#no_transactions=>0 ==> delete fixtures after every execution - -BEGIN { $ENV{MOJO_MODE} = "test" } - -my $schema = Schema->connect_to_database; -my $dbh = Schema->database_handle; -my $t = Test::Mojo->new('TrafficOps'); - -Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); - -ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -my $q = 'select * from type limit 1'; -my $get_ds = $dbh->prepare($q); -$get_ds->execute(); -my $p = $get_ds->fetchall_arrayref( {} ); -$get_ds->finish(); - -# create a new param -$t->post_ok( - '/types/create' => form => { - 'type_data.name' => 'JLP_TEST_SERVER', - 'type_data.description' => 'JLP test host', - 'type_data.use_in_table' => 'server' - - } -)->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -# modify and delete it -&upd_and_del(); - -sub upd_and_del() { - my $q = 'select id from type where name = \'JLP_TEST_SERVER\''; - my $get_ds = $dbh->prepare($q); - $get_ds->execute(); - my $p = $get_ds->fetchall_arrayref( {} ); - $get_ds->finish(); - my $i = 0; - while ( defined( $p->[$i] ) ) { - my $id = $p->[$i]->{id}; - $t->post_ok( - '/types/' - . $id - . '/update' => form => { - 'type_data.name' => 'JLP_TEST_SERVER', - 'type_data.description' => 'JLP test host updated', - 'type_data.use_in_table' => 'server' - } - )->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - $t->get_ok( '/types/' . $id . '/delete' )->status_is(302); - $i++; - } -} -ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -$dbh->disconnect(); -done_testing(); From de2cd7a980184925a7c0739b323131b64f9ecb2d Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:23:32 -0700 Subject: [PATCH 10/38] removed because it didnt test anything real --- traffic_ops/app/t/uploadhandlercsv.t | 57 ---------------------------- 1 file changed, 57 deletions(-) delete mode 100644 traffic_ops/app/t/uploadhandlercsv.t diff --git a/traffic_ops/app/t/uploadhandlercsv.t b/traffic_ops/app/t/uploadhandlercsv.t deleted file mode 100644 index d78fb26fd2..0000000000 --- a/traffic_ops/app/t/uploadhandlercsv.t +++ /dev/null @@ -1,57 +0,0 @@ -package main; -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use Mojo::Base -strict; -use Test::More; -use Test::Mojo; -use Data::Dumper; -use DBI; -use Test::TestHelper; -use Schema; -use strict; -use warnings; - -#no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! -#no_transactions=>0 ==> delete fixtures after every execution - -BEGIN { $ENV{MOJO_MODE} = "test" } - -my $schema = Schema->connect_to_database; -my $dbh = Schema->database_handle; -my $t = Test::Mojo->new('TrafficOps'); - -Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); - -ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -my $q = 'select * from server where type = 18 limit 1'; -my $get_servers = $dbh->prepare($q); -$get_servers->execute(); -my $svr = $get_servers->fetchall_arrayref( {} ); -$get_servers->finish(); -my $test_server_id = $svr->[0]->{id}; - -# the jsons associated with server -$t->get_ok( '/server_by_id/' . $test_server_id )->status_is(200)->json_is( '/host_name', $svr->[0]->{host_name} ) - ->json_is( '/domain_name', $svr->[0]->{domain_name} )->json_is( '/tcp_port', $svr->[0]->{tcp_port} ) - ->json_is( '/interface_name', $svr->[0]->{interface_name} )->json_is( '/ip_address', $svr->[0]->{ip_address} ) - ->json_is( '/ip_netmask', $svr->[0]->{ip_netmask} )->json_is( '/ip_gateway', $svr->[0]->{ip_gateway} ) - ->json_is( '/interface_mtu', $svr->[0]->{interface_mtu} ); - -ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -$dbh->disconnect(); -done_testing(); From 078f83b87f0533999970e713099e87a73e6f847a Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:23:46 -0700 Subject: [PATCH 11/38] fixed the role result after data alignment --- traffic_ops/app/t/user.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/t/user.t b/traffic_ops/app/t/user.t index 5a53490051..2bbf59cbd9 100644 --- a/traffic_ops/app/t/user.t +++ b/traffic_ops/app/t/user.t @@ -45,7 +45,7 @@ ok $t->post_ok( => form => { 'tm_user.full_name' => 'fullname', 'tm_user.username' => 'testcase', - 'tm_user.public_ssh_key' => 'ssh-key', + 'tm_user.public_ssh_key' => 'ssh-key', 'tm_user.phone_number' => 'phone_number', 'tm_user.email' => 'email@email.com', 'tm_user.local_passwd' => 'password', @@ -55,7 +55,7 @@ ok $t->post_ok( } )->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Can a user be created?'; -ok $t->get_ok('/datauser')->status_is(200)->json_is( '/0/username', 'admin' )->json_is( '/0/role', 1 ), 'Does the admin username exist?'; +ok $t->get_ok('/datauser')->status_is(200)->json_is( '/0/username', 'admin' )->json_is( '/0/role', 4 ), 'Does the admin username exist?'; ok $t->get_ok('/datauser/orderby/role')->status_is(200)->json_has('/0/rolename')->json_has('/0/username')->json_has('/0/id')->json_has('/0/role'), 'Does the user sort by role?'; From f9ce9aff2a4881fc20f9cfbaffd903daede76127 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:27:46 -0700 Subject: [PATCH 12/38] corrected test result --- traffic_ops/app/t/api/1.1/hwinfo.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_ops/app/t/api/1.1/hwinfo.t b/traffic_ops/app/t/api/1.1/hwinfo.t index c3a042f4fa..f3ad4b7b60 100644 --- a/traffic_ops/app/t/api/1.1/hwinfo.t +++ b/traffic_ops/app/t/api/1.1/hwinfo.t @@ -43,7 +43,7 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::PORTAL_USER, p => $t->get_ok("/api/1.1/hwinfo.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/description", "BACKPLANE FIRMWA" )->json_is( "/response/0/val", "7.0.0.29" ) - ->json_is( "/response/0/serverHostName", "atlanta-edge-02" )->json_is( "/response/1/description", "DRAC FIRMWA" ) + ->json_is( "/response/0/serverHostName", "atlanta-edge-01" )->json_is( "/response/1/description", "DRAC FIRMWA" ) ->json_is( "/response/1/val", "1.0.0.29" )->json_is( "/response/1/serverHostName", "atlanta-mid-01" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); From 477ed3ffeec2362e2fa79e0bbece82ab3ffa611a Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:41:05 -0700 Subject: [PATCH 13/38] fixed the job api --- traffic_ops/app/lib/Fixtures/Job.pm | 6 ++--- .../app/t/api/1.1/deliveryserviceserver.t | 2 +- traffic_ops/app/t/api/1.1/job.t | 22 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Job.pm b/traffic_ops/app/lib/Fixtures/Job.pm index d64aed1f03..ad01cceb05 100644 --- a/traffic_ops/app/lib/Fixtures/Job.pm +++ b/traffic_ops/app/lib/Fixtures/Job.pm @@ -30,8 +30,8 @@ my %definition_for = ( asset_type => 'file', status => 1, start_time => $now, - job_user => 1, - job_deliveryservice => 2, + job_user => 100, + job_deliveryservice => 100, entered_time => $now }, }, @@ -44,7 +44,7 @@ sub get_definition { sub all_fixture_names { # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{name} cmp $definition_for{$b}{using}{name} } keys %definition_for); + return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/t/api/1.1/deliveryserviceserver.t b/traffic_ops/app/t/api/1.1/deliveryserviceserver.t index 42fa37a683..c798d2dc79 100644 --- a/traffic_ops/app/t/api/1.1/deliveryserviceserver.t +++ b/traffic_ops/app/t/api/1.1/deliveryserviceserver.t @@ -42,7 +42,7 @@ ok $t->post_ok( '/login', => form => { u => 'portal', p => Test::TestHelper::ADM ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.1/deliveryserviceserver.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/server", "1" )->json_is( "/response/0/deliveryService", "1" )->json_is( "/limit", "20" ) + ->json_is( "/response/0/server", "100" )->json_is( "/response/0/deliveryService", "100" )->json_is( "/limit", "20" ) ->json_is( "/orderby", "deliveryservice" ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); diff --git a/traffic_ops/app/t/api/1.1/job.t b/traffic_ops/app/t/api/1.1/job.t index b72f41214a..c76461a55e 100644 --- a/traffic_ops/app/t/api/1.1/job.t +++ b/traffic_ops/app/t/api/1.1/job.t @@ -73,7 +73,7 @@ ok $t->get_ok('/api/1.1/user/current/jobs.json')->status_is(200)->json_has( '/re ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo1/.*', ttl => 48, startTime => $now, @@ -84,31 +84,31 @@ ok $t->post_ok( ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo1/.*', ttl => 0, startTime => $now, } - )->status_is(400)->json_is( '/alerts', [ { level => "error", text => "ttl should be between 1 and 2160" } ] ) + )->status_is(400)->json_is( '/alerts', [ { level => "error", text => "ttl should be between 1 and 72" } ] ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Will not create a purge job without the ttl in the proper low range?'; ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo1/.*', ttl => 3000, startTime => $now, } - )->status_is(400)->json_is( '/alerts', [ { level => "error", text => "ttl should be between 1 and 2160" } ] ) + )->status_is(400)->json_is( '/alerts', [ { level => "error", text => "ttl should be between 1 and 72" } ] ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Will not create a purge job without the ttl in the proper high range?'; ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo2/.*', ttl => 49, startTime => $now, @@ -118,7 +118,7 @@ ok $t->post_ok( ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 9, + dsId => 800, regex => '/foo2/.*', ttl => 49, startTime => $now, @@ -128,7 +128,7 @@ ok $t->post_ok( ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, ttl => 49, startTime => $now, } @@ -139,7 +139,7 @@ ok $t->post_ok( ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo2/.*', ttl => 49, } @@ -150,7 +150,7 @@ ok $t->post_ok( ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo2/.*', ttl => 49, startTime => '2015-01-09', @@ -163,7 +163,7 @@ ok $t->post_ok( ok $t->post_ok( '/api/1.1/user/current/jobs', json => { - dsId => 8, + dsId => 100, regex => '/foo2/.*', startTime => $now, } From 9dec13ae6544c11bfb3c313858c1c9542588bcfa Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:48:56 -0700 Subject: [PATCH 14/38] fixed the role, and types test case alignment --- traffic_ops/app/t/api/1.1/roles.t | 2 +- traffic_ops/app/t/api/1.1/types.t | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/traffic_ops/app/t/api/1.1/roles.t b/traffic_ops/app/t/api/1.1/roles.t index c720d36d2b..2b21e45eed 100644 --- a/traffic_ops/app/t/api/1.1/roles.t +++ b/traffic_ops/app/t/api/1.1/roles.t @@ -39,7 +39,7 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok('/api/1.1/roles.json?orderby=name')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/id", "1" )->json_is( "/response/0/description", "super-user" )->json_is( "/response/0/name", "admin" ) + ->json_is( "/response/0/id", "4" )->json_is( "/response/0/description", "super-user" )->json_is( "/response/0/name", "admin" ) ->json_is( "/response/0/privLevel", "30" )->json_is( "/response/6/description", "block all access" )->json_is( "/response/6/name", "read-only user" ) ->json_is( "/response/6/privLevel", "10" ); diff --git a/traffic_ops/app/t/api/1.1/types.t b/traffic_ops/app/t/api/1.1/types.t index fc15176079..f44fef885d 100644 --- a/traffic_ops/app/t/api/1.1/types.t +++ b/traffic_ops/app/t/api/1.1/types.t @@ -39,9 +39,9 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok('/api/1.1/types.json?orderby=id')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/name", "AAAA_RECORD" )->json_is( "/response/0/description", "Static DNS AAAA entry" )->json_is( "/response/0/useInTable", "staticdnsentry" ) + ->json_is( "/response/0/name", "EDGE" )->json_is( "/response/0/description", "Edge Cache" )->json_is( "/response/0/useInTable", "server" ) - ->json_is( "/response/22/name", "RASCAL" )->json_is( "/response/22/description", "Rascal health polling & reporting" )->json_is( "/response/22/useInTable", "server" ); + ->json_is( "/response/22/name", "INFLUXDB" )->json_is( "/response/22/description", "influxdb type" )->json_is( "/response/22/useInTable", "server" ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); From a7b527047f18635f0be19769416e5c6522312a28 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 13:49:07 -0700 Subject: [PATCH 15/38] fixed the log fixture tm_user pointer --- traffic_ops/app/lib/Fixtures/Log.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/Log.pm b/traffic_ops/app/lib/Fixtures/Log.pm index 838a00baac..1377db81eb 100644 --- a/traffic_ops/app/lib/Fixtures/Log.pm +++ b/traffic_ops/app/lib/Fixtures/Log.pm @@ -25,7 +25,7 @@ my %definition_for = ( level => 'APICHANGE', ticketnum => 123, message => 'Message1', - tm_user => 1, + tm_user => 100, }, }, message2 => { @@ -35,7 +35,7 @@ my %definition_for = ( level => 'APICHANGE', ticketnum => 456, message => 'Message2', - tm_user => 1, + tm_user => 100, }, }, ); From defc0fbde310031138ba16cf1b6ed2e7eca31193 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 14:01:05 -0700 Subject: [PATCH 16/38] fixed the data alignment --- traffic_ops/app/t/api/1.1/server.t | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/traffic_ops/app/t/api/1.1/server.t b/traffic_ops/app/t/api/1.1/server.t index a1c0341481..5aae814de5 100644 --- a/traffic_ops/app/t/api/1.1/server.t +++ b/traffic_ops/app/t/api/1.1/server.t @@ -39,32 +39,32 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok('/api/1.1/servers.json?orderby=id')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/1/status", "ONLINE" )->json_is( "/response/1/ipGateway", "127.0.0.7" )->json_is( "/response/1/ip6Gateway", "2345:1234:12:d::1" ) - ->json_is( "/response/1/tcpPort", "80" )->json_is( "/response/1/cachegroup", "edge_atl_group" ) - ->json_is( "/response/1/hostName", "atlanta-edge-02" )->json_is( "/response/1/domainName", "ga.atlanta.kabletown.net" ) - ->json_is( "/response/1/ipAddress", "127.0.0.7" )->json_is( "/response/1/profile", "EDGE1" )->json_is( "/response/1/type", "EDGE" ) - ->json_is( "/response/1/physLocation", "Boulder" )->json_is( "/response/1/interfaceName", "bond0" )->json_is( "/response/1/interfaceMtu", "9000" ) + ->json_is( "/response/1/status", "ONLINE" )->json_is( "/response/1/ipGateway", "127.0.0.2" )->json_is( "/response/1/ip6Gateway", "2345:1234:12:9::1" ) + ->json_is( "/response/1/tcpPort", "80" )->json_is( "/response/1/cachegroup", "mid-northeast-group" ) + ->json_is( "/response/1/hostName", "atlanta-mid-01" )->json_is( "/response/1/domainName", "ga.atlanta.kabletown.net" ) + ->json_is( "/response/1/ipAddress", "127.0.0.2" )->json_is( "/response/1/profile", "MID1" )->json_is( "/response/1/type", "MID" ) + ->json_is( "/response/1/physLocation", "Denver" )->json_is( "/response/1/interfaceName", "bond0" )->json_is( "/response/1/interfaceMtu", "9000" ) - ->json_is( "/response/2/status", "ONLINE" )->json_is( "/response/2/ipGateway", "127.0.0.1" )->json_is( "/response/2/ip6Gateway", "2345:1234:12:8::1" ) - ->json_is( "/response/2/tcpPort", "80" )->json_is( "/response/2/cachegroup", "edge_atl_group" )->json_is( "/response/2/hostName", "atlanta-edge-03" ) - ->json_is( "/response/2/domainName", "ga.atlanta.kabletown.net" )->json_is( "/response/2/ipAddress", "127.0.0.13" )->json_is( "/response/2/profile", "EDGE1" ) - ->json_is( "/response/2/type", "EDGE" )->json_is( "/response/2/physLocation", "Boulder" )->json_is( "/response/2/interfaceName", "bond0" ) + ->json_is( "/response/2/status", "ONLINE" )->json_is( "/response/2/ipGateway", "127.0.0.4" )->json_is( "/response/2/ip6Gateway", "2345:1234:12:b::1" ) + ->json_is( "/response/2/tcpPort", "81" )->json_is( "/response/2/cachegroup", "mid-northeast-group" )->json_is( "/response/2/hostName", "rascal01" ) + ->json_is( "/response/2/domainName", "kabletown.net" )->json_is( "/response/2/ipAddress", "127.0.0.4" )->json_is( "/response/2/profile", "CCR1" ) + ->json_is( "/response/2/type", "CCR" )->json_is( "/response/2/physLocation", "Denver" )->json_is( "/response/2/interfaceName", "bond0" ) ->json_is( "/response/2/interfaceMtu", "9000" ) - ->json_is( "/response/4/status", "ONLINE" )->json_is( "/response/4/ipGateway", "127.0.0.8" )->json_is( "/response/4/ip6Gateway", "2345:1234:12:e::1" ) - ->json_is( "/response/4/tcpPort", "80" )->json_is( "/response/4/cachegroup", "mid-northwest-group" )->json_is( "/response/4/hostName", "atlanta-mid-02" ) - ->json_is( "/response/4/domainName", "ga.atlanta.kabletown.net" )->json_is( "/response/4/ipAddress", "127.0.0.8" )->json_is( "/response/4/profile", "MID1" ) - ->json_is( "/response/4/type", "MID" )->json_is( "/response/4/physLocation", "Denver" )->json_is( "/response/4/interfaceName", "bond0" ) + ->json_is( "/response/4/status", "ONLINE" )->json_is( "/response/4/ipGateway", "127.0.0.6" )->json_is( "/response/4/ip6Gateway", "2345:1234:12:c::1" ) + ->json_is( "/response/4/tcpPort", "81" )->json_is( "/response/4/cachegroup", "mid-northeast-group" )->json_is( "/response/4/hostName", "rascal02" ) + ->json_is( "/response/4/domainName", "kabletown.net" )->json_is( "/response/4/ipAddress", "127.0.0.6" )->json_is( "/response/4/profile", "CCR1" ) + ->json_is( "/response/4/type", "CCR" )->json_is( "/response/4/physLocation", "Denver" )->json_is( "/response/4/interfaceName", "bond0" ) ->json_is( "/response/4/interfaceMtu", "9000" ) - ->json_is( "/response/7/status", "ONLINE" )->json_is( "/response/7/ipGateway", "127.0.0.11" )->json_is( "/response/7/ip6Gateway", "127.0.0.11" ) - ->json_is( "/response/7/tcpPort", "8086" )->json_is( "/response/7/cachegroup", "mid-northeast-group" )->json_is( "/response/7/hostName", "influxdb02" ) - ->json_is( "/response/7/domainName", "kabletown.net" )->json_is( "/response/7/ipAddress", "127.0.0.11" )->json_is( "/response/7/profile", "RASCAL1" ) - ->json_is( "/response/7/type", "INFLUXDB" )->json_is( "/response/7/physLocation", "HotAtlanta" )->json_is( "/response/7/interfaceName", "eth1" ) + ->json_is( "/response/7/status", "ONLINE" )->json_is( "/response/7/ipGateway", "127.0.0.9" )->json_is( "/response/7/ip6Gateway", "2345:1234:12:f::1" ) + ->json_is( "/response/7/tcpPort", "8088" )->json_is( "/response/7/cachegroup", "mid-northeast-group" )->json_is( "/response/7/hostName", "riak02" ) + ->json_is( "/response/7/domainName", "kabletown.net" )->json_is( "/response/7/ipAddress", "127.0.0.9" )->json_is( "/response/7/profile", "RIAK1" ) + ->json_is( "/response/7/type", "RIAK" )->json_is( "/response/7/physLocation", "Boulder" )->json_is( "/response/7/interfaceName", "eth1" ) ->json_is( "/response/7/interfaceMtu", "1500" ); $t->get_ok('/api/1.1/servers/hostname/atlanta-edge-01/details.json')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/ipGateway", "127.0.0.1" )->json_is( "/response/deliveryservices/0", "8" ); + ->json_is( "/response/ipGateway", "127.0.0.1" )->json_is( "/response/deliveryservices/0", "100" ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); From fe88243becc38eeff568f414060b2042381a6954 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 14:35:16 -0700 Subject: [PATCH 17/38] fixed the delivery servivce id --- traffic_ops/app/lib/Fixtures/Staticdnsentry.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm index d7866d662d..8da2a8eb9e 100644 --- a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm +++ b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm @@ -25,7 +25,7 @@ my %definition_for = ( host => 'A_RECORD_HOST', address => '127.0.0.1', type => 21, - deliveryservice => 1, + deliveryservice => 100, cachegroup => 1, }, }, From f32c5508ccc453cae4d6ab16a331b0d5f6e03461 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 14:36:57 -0700 Subject: [PATCH 18/38] fixed test data --- traffic_ops/app/t/api/1.1/staticdns.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/t/api/1.1/staticdns.t b/traffic_ops/app/t/api/1.1/staticdns.t index 047a848348..063d2bf85c 100644 --- a/traffic_ops/app/t/api/1.1/staticdns.t +++ b/traffic_ops/app/t/api/1.1/staticdns.t @@ -42,10 +42,10 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T $t->get_ok('/api/1.1/staticdnsentries.json?orderby=host')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/ttl", "3600" )->json_is( "/response/0/host", "AAAA_RECORD_HOST" )->json_is( "/response/0/cachegroup", "mid-northeast-group" ) - ->json_is( "/response/0/deliveryservice", "steering-ds1" )->json_is( "/response/0/address", "127.0.0.1" )->json_is( "/response/0/type", "AAAA_RECORD" ) + ->json_is( "/response/0/deliveryservice", "test-ds1" )->json_is( "/response/0/address", "127.0.0.1" )->json_is( "/response/0/type", "AAAA_RECORD" ) ->json_is( "/response/2/ttl", "3600" )->json_is( "/response/2/host", "CNAME_HOST" )->json_is( "/response/2/cachegroup", "mid-northwest-group" ) - ->json_is( "/response/2/deliveryservice", "steering-ds2" )->json_is( "/response/2/address", "127.0.0.1" )->json_is( "/response/2/type", "CNAME_RECORD" ); + ->json_is( "/response/2/deliveryservice", "test-ds2" )->json_is( "/response/2/address", "127.0.0.1" )->json_is( "/response/2/type", "CNAME_RECORD" ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); From 5f4754219a5786453622d9c28dca3044821c4703 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 15:18:42 -0700 Subject: [PATCH 19/38] fixed the cachegroup test case --- traffic_ops/app/t/api/1.2/cachegroup.t | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/cachegroup.t b/traffic_ops/app/t/api/1.2/cachegroup.t index ec3d8d92da..57d1b19076 100644 --- a/traffic_ops/app/t/api/1.2/cachegroup.t +++ b/traffic_ops/app/t/api/1.2/cachegroup.t @@ -32,8 +32,19 @@ my $schema = Schema->connect_to_database; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); +my $schema_values = { schema => $schema, no_transactions => 1 }; Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Status->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Parameter->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::ProfileParameter->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Division->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Region->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::PhysLocation->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) ); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; @@ -54,6 +65,23 @@ ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} = ->json_is( "/response/secondaryParentCachegroup" => "") , 'Does the cache group details return?'; +ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { + "name" => "mid-northeast-group", + "shortName" => "mid-ne-group", + "latitude" => "44", + "longitude" => "66", + "parentCachegroup" => "", + "secondaryParentCachegroup" => "", + "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/name" => "mid-northeast-group" ) + ->json_is( "/response/shortName" => "mid-ne-group") + ->json_is( "/response/latitude" => "44") + ->json_is( "/response/longitude" => "66") + ->json_is( "/response/parentCachegroup" => "") + ->json_is( "/response/secondaryParentCachegroup" => "") + , 'Does the cache group details return?'; + + ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { "name" => "cache_group_edge", "shortName" => "cg_edge", @@ -107,7 +135,7 @@ ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} = ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "tc1_ats2", - "domainName" => "my.cisco.com", + "domainName" => "my.domain.com", "cachegroup" => "mid-northeast-group", "cdnName" => "cdn1", "interfaceName" => "eth0", From d74102019519b981a5663b744286085a3f82dd68 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 15:25:05 -0700 Subject: [PATCH 20/38] restored from master --- traffic_ops/app/t/api/1.2/cdn.t | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/cdn.t b/traffic_ops/app/t/api/1.2/cdn.t index 1cd476bb91..a357f0345e 100644 --- a/traffic_ops/app/t/api/1.2/cdn.t +++ b/traffic_ops/app/t/api/1.2/cdn.t @@ -19,6 +19,8 @@ use Test::Mojo; use DBI; use strict; use warnings; +no warnings 'once'; +use warnings 'all'; use Test::TestHelper; #no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! @@ -26,21 +28,24 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } -my $t = Test::Mojo->new('TrafficOps'); -my $dbh = Schema->database_handle; my $schema = Schema->connect_to_database; +my $dbh = Schema->database_handle; +my $t = Test::Mojo->new('TrafficOps'); -#unload data for a clean test Test::TestHelper->unload_core_data($schema); - -#load core test data Test::TestHelper->load_core_data($schema); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); + ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; -$t->get_ok("/api/1.2/cdns/capacity.json")->status_is(200)->json_is( "/response/unavailablePercent", "0" )->json_is( "/response/availablePercent", "0" ) - ->json_is( "/response/utilizedPercent", "0" )->json_is( "/response/maintenancePercent", "0" ) +ok $t->post_ok('/api/1.2/cdns' => {Accept => 'application/json'} => json => { + "name" => "cdn_test" + }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/name" => "cdn_test" ) + ->json_is( "/alerts/0/level" => "success" ) + ->json_is( "/alerts/0/text" => "cdn was created." ) + , 'Does the cdn details return?'; my $cdn_id = &get_cdn_id('cdn_test'); @@ -60,6 +65,16 @@ ok $t->put_ok('/api/1.2/cdns/' . $cdn_id => {Accept => 'application/json'} => j ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - $dbh->disconnect(); done_testing(); + +sub get_cdn_id { + my $name = shift; + my $q = "select id from cdn where name = \'$name\'"; + my $get_svr = $dbh->prepare($q); + $get_svr->execute(); + my $p = $get_svr->fetchall_arrayref( {} ); + $get_svr->finish(); + my $id = $p->[0]->{id}; + return $id; +} From 3a8c1ae446512f373387ad10cb2c54327e2ea76f Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 15:45:02 -0700 Subject: [PATCH 21/38] realigned the test data --- traffic_ops/app/t/api/1.2/deliveryservice.t | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/deliveryservice.t b/traffic_ops/app/t/api/1.2/deliveryservice.t index 2f10add501..4e9e961621 100644 --- a/traffic_ops/app/t/api/1.2/deliveryservice.t +++ b/traffic_ops/app/t/api/1.2/deliveryservice.t @@ -42,10 +42,10 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T # It gets existing delivery services ok $t->get_ok("/api/1.2/deliveryservices/list")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content} } ) - ->json_is( "/response/0/xmlId", "test-ds1" ) - ->json_is( "/response/0/logsEnabled", 1 ) + ->json_is( "/response/0/xmlId", "steering-ds1" ) + ->json_is( "/response/0/logsEnabled", 0 ) ->json_is( "/response/0/ipv6RoutingEnabled", 1 ) - ->json_is( "/response/1/xmlId", "test-ds2" ); + ->json_is( "/response/1/xmlId", "steering-ds2" ); ok $t->get_ok("/api/1.2/deliveryservices/list?logsEnabled=true")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content} } ) ->json_is( "/response/0/xmlId", "test-ds1" ) @@ -309,8 +309,8 @@ ok $t->post_ok( 'Does the assigned servers return?'; ok $t->get_ok("/api/1.2/deliveryservices.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content} } ) - ->json_is( "/response/0/xmlId", "steering-ds1" )->json_is( "/response/0/logsEnabled", 0 )->json_is( "/response/0/ipv6RoutingEnabled", 1 ) - ->json_is( "/response/1/xmlId", "steering-ds2" ); + ->json_is( "/response/0/xmlId", "ds_2" )->json_is( "/response/0/logsEnabled", 0 )->json_is( "/response/0/ipv6RoutingEnabled", 0 ) + ->json_is( "/response/1/xmlId", "ds_3" ); # Count the 'response number' my $count_response = sub { From 80cce8a4b077fd4ffe810bca17682cd5d838d54d Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:11:05 -0700 Subject: [PATCH 22/38] made changes to fix the cachegroup and parameter test cases --- traffic_ops/app/lib/API/Parameter.pm | 3 +- traffic_ops/app/t/api/1.2/cachegroup.t | 5 ++- traffic_ops/app/t/api/1.2/parameter.t | 50 +++++++++++++++++++++----- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/traffic_ops/app/lib/API/Parameter.pm b/traffic_ops/app/lib/API/Parameter.pm index 218d00339b..bd46927d96 100644 --- a/traffic_ops/app/lib/API/Parameter.pm +++ b/traffic_ops/app/lib/API/Parameter.pm @@ -93,8 +93,6 @@ sub create { return $self->forbidden("You must be an admin or oper to perform this operation!"); } - $self->app->log->info("params = " . Dumper($params)); - if ( ref($params) ne 'ARRAY' ) { #not a array, create single parameter my @temparry; @@ -255,6 +253,7 @@ sub delete { } my $find = $self->db->resultset('Parameter')->find({ id => $id } ); + $self->app->log->debug("defined find #-> " . defined($find)); if ( !defined($find) ) { return $self->not_found("parameter [id:".$id."] does not exist."); } diff --git a/traffic_ops/app/t/api/1.2/cachegroup.t b/traffic_ops/app/t/api/1.2/cachegroup.t index 57d1b19076..a03b2266d5 100644 --- a/traffic_ops/app/t/api/1.2/cachegroup.t +++ b/traffic_ops/app/t/api/1.2/cachegroup.t @@ -29,11 +29,14 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); -my $schema_values = { schema => $schema, no_transactions => 1 }; Test::TestHelper->unload_core_data($schema); + +# Load the test data up until 'cachegroup', because this test case creates +# them. Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); diff --git a/traffic_ops/app/t/api/1.2/parameter.t b/traffic_ops/app/t/api/1.2/parameter.t index 9c44078b9f..dbe287d7bb 100644 --- a/traffic_ops/app/t/api/1.2/parameter.t +++ b/traffic_ops/app/t/api/1.2/parameter.t @@ -16,11 +16,20 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); + +# Load the test data up until 'cachegroup', because this test case creates +# them. +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Status->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) ); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; @@ -66,6 +75,22 @@ ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json = ->json_is( "/response/1/secure" => "1" ) , 'Does the paramters created return?'; +ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json => [ + { + 'name' => 'param3', + 'configFile' => 'configFile3', + 'value' => 'value3', + 'secure' => '0' + }, + { + name => 'domain_name', + value => 'foo.com', + configFile => 'CRConfig.json', + 'secure' => '0' + } + ])->status_is(200) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ); + ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json => [ { 'name' => 'param3', @@ -81,7 +106,7 @@ ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json = } ])->status_is(400) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/alerts/0/text" => "parameter [name:domain_name , configFile:CRConfig.json , value:foo.com] already exists." ) + ->json_is( "/alerts/0/text" => "parameter [name:param3 , configFile:configFile3 , value:value3] already exists." ) , 'Does the paramters created return?'; ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json => [ @@ -98,8 +123,8 @@ ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json = } ])->status_is(400) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/alerts/0/text" => 'there is parameter value does not provide , name:param3 , configFile:CRConfig.json' ) - , 'Does the paramters created return?'; + ->json_is( "/alerts/0/text" => 'parameter [name:param3 , configFile:configFile3 , value:value3] already exists.' ) + , 'Does the paramters create return?'; ok $t->post_ok('/api/1.2/parameters' => {Accept => 'application/json'} => json => [ { @@ -147,12 +172,20 @@ ok $t->put_ok('/api/1.2/parameters/0' => {Accept => 'application/json'} => json ok $t->delete_ok('/api/1.2/parameters/' . $para_id )->status_is(200) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - , 'Does the paramter delete return?'; + , 'Does the parameter delete return?'; -ok $t->delete_ok('/api/1.2/parameters/3' )->status_is(400) +$para_id = &get_param_id('param10'); +ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => { + "profileId" => 300, "parameterId" => $para_id })->status_is(200) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/profileId" => "300" ) + ->json_is( "/response/0/parameterId" => $para_id ) + , 'Does the profile parameter details return?'; + +ok $t->delete_ok('/api/1.2/parameters/' . $para_id )->status_is(400) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_like( "/alerts/0/text" => qr/has profile associated/ ) - , 'Does the paramter delete return?'; + , 'Does the parameter delete return?'; ok $t->post_ok('/api/1.2/parameters/validate' => {Accept => 'application/json'} => json => { 'name' => 'param1', @@ -230,7 +263,8 @@ ok $t->delete_ok('/api/1.2/parameters/' . $para_id )->status_is(403) ->json_is( "/alerts/0/text" => "You must be an admin or oper to perform this operation!" ) , 'Does the paramter delete return?'; -ok $t->get_ok('/api/1.2/parameters/3')->status_is(200) +$para_id = &get_param_id('domain_name'); +ok $t->get_ok('/api/1.2/parameters/'. $para_id)->status_is(200) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/name" => "domain_name" ) ->json_is( "/response/0/value" => "foo.com" ) From bea4741f867f5d642ecc1e97a29749274df5e21b Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:16:50 -0700 Subject: [PATCH 23/38] fixed the cdn test case --- traffic_ops/app/t/api/1.2/cdn.t | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/cdn.t b/traffic_ops/app/t/api/1.2/cdn.t index a357f0345e..aed0845af1 100644 --- a/traffic_ops/app/t/api/1.2/cdn.t +++ b/traffic_ops/app/t/api/1.2/cdn.t @@ -29,18 +29,19 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; ok $t->post_ok('/api/1.2/cdns' => {Accept => 'application/json'} => json => { - "name" => "cdn_test" - }) + "name" => "cdn_test", "dnssecEnabled" => "true" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "cdn_test" ) ->json_is( "/alerts/0/level" => "success" ) @@ -50,7 +51,7 @@ ok $t->post_ok('/api/1.2/cdns' => {Accept => 'application/json'} => json => { my $cdn_id = &get_cdn_id('cdn_test'); ok $t->put_ok('/api/1.2/cdns/' . $cdn_id => {Accept => 'application/json'} => json => { - "name" => "cdn_test2" + "name" => "cdn_test2", "dnssecEnabled" => "true" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "cdn_test2" ) From 23f29f2c4ecf85b965f29c0356f9f5c7d389caaf Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:19:13 -0700 Subject: [PATCH 24/38] fixed the test case data alignment --- traffic_ops/app/t/api/1.2/deliveryservice_matches.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_matches.t b/traffic_ops/app/t/api/1.2/deliveryservice_matches.t index e4f2ab9614..a03adad0e7 100644 --- a/traffic_ops/app/t/api/1.2/deliveryservice_matches.t +++ b/traffic_ops/app/t/api/1.2/deliveryservice_matches.t @@ -42,11 +42,11 @@ ok $t->post_ok( '/api/1.1/user/login', json => { u => Test::TestHelper::ADMIN_US ok $t->get_ok("/api/1.2/deliveryservice_matches.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_has( '/response', 'has a response' )->json_is( '/response/0/dsName', 'steering_ds1' )->json_has( '/response/0/patterns', 'has a first match' ) - ->json_is( '/response/1/dsName', 'steering_ds2' )->json_has( '/response/1/patterns', 'has a second match' ), 'Query matches'; + ->json_is( '/response/1/dsName', 'test_ds1' )->json_has( '/response/1/patterns', 'has a second match' ), 'Query matches'; ok $t->get_ok("/api/1.2/deliveryservice_matches.json?format=file")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_hasnt( '/response', 'should not have a response' )->json_is( '/0/dsName', 'steering_ds1' )->json_has( '/0/patterns', 'has a first match' ) - ->json_is( '/1/dsName', 'steering_ds2' )->json_has( '/1/patterns', 'has a second match' ), 'Query matches'; + ->json_is( '/1/dsName', 'test_ds1' )->json_has( '/1/patterns', 'has a second match' ), 'Query matches'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); From 89a5aaab57a59e51485ee15f024aa8cedf669984 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:22:52 -0700 Subject: [PATCH 25/38] fixed the test data alignment --- traffic_ops/app/t/api/1.2/deliveryservice_regex.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_regex.t b/traffic_ops/app/t/api/1.2/deliveryservice_regex.t index 8bd75ffbe5..a2390b1daa 100644 --- a/traffic_ops/app/t/api/1.2/deliveryservice_regex.t +++ b/traffic_ops/app/t/api/1.2/deliveryservice_regex.t @@ -42,8 +42,8 @@ ok $t->post_ok( '/api/1.1/user/login', json => { u => Test::TestHelper::ADMIN_US ok $t->get_ok("/api/1.2/deliveryservices_regexes.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_has( '/response', 'has a response' )->json_is( '/response/0/dsName', 'steering-ds1' )->json_has( '/response/0/regexes/0/type', 'has a regex type' ) - ->json_is( '/response/0/regexes/0/type', 'HTTP_NO_CACHE' )->json_is( '/response/1/dsName', 'steering-ds2' ) - ->json_has( '/response/1/regexes', 'has a second regex' )->json_has( '/response/1/regexes/0/type', 'has a second regex type' ), 'Query regexes'; + ->json_is( '/response/0/regexes/0/type', 'HOST_REGEXP' )->json_is( '/response/1/dsName', 'steering-ds2' ) + ->json_has( '/response/1/regexes', 'has a second regex' )->json_has( '/response/7/regexes/0/type', 'has a second regex type' ), 'Query regexes'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); From 490137015491fdeafb4e3c169949e78bb0a5c45b Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:27:33 -0700 Subject: [PATCH 26/38] fixed the test data alignment --- .../app/t/api/1.2/deliveryservice_server.t | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_server.t b/traffic_ops/app/t/api/1.2/deliveryservice_server.t index 7b039370a8..9f705de5f7 100644 --- a/traffic_ops/app/t/api/1.2/deliveryservice_server.t +++ b/traffic_ops/app/t/api/1.2/deliveryservice_server.t @@ -42,24 +42,22 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; ok $t->post_ok('/api/1.2/cachegroups/3/deliveryservices' => {Accept => 'application/json'} => json => { - "deliveryServices" => [ - 1 - ]}) + "deliveryServices" => [ 100 ]}) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/id" => 3 ) - ->json_is( "/response/deliveryServices/0" => 1 ) + ->json_is( "/response/deliveryServices/0" => 100 ) ->json_is( "/alerts/0/level" => "success" ) ->json_is( "/alerts/0/text" => "Delivery services successfully assigned to all the servers of cache group 3" ) , 'Does the delivery services assign details return?'; ok $t->get_ok('/api/1.2/deliveryserviceserver.json') ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/deliveryService" => "1" ) - ->json_is( "/response/0/server" => "1" ) - ->json_is( "/response/1/deliveryService" => "1" ) - ->json_is( "/response/1/server" => "2" ) - ->json_is( "/response/2/deliveryService" => "1" ) - ->json_is( "/response/2/server" => "3" ) + ->json_is( "/response/0/deliveryService" => "100" ) + ->json_is( "/response/0/server" => "100" ) + ->json_is( "/response/1/deliveryService" => "100" ) + ->json_is( "/response/1/server" => "300" ) + ->json_is( "/response/2/deliveryService" => "100" ) + ->json_is( "/response/2/server" => "600" ) , 'Does the delivery services servers details return?'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); From 542a51b2a266e374ca7f2637ce86b4f238dc91d5 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:30:38 -0700 Subject: [PATCH 27/38] fixed the test data alignment --- traffic_ops/app/t/api/1.2/division.t | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/division.t b/traffic_ops/app/t/api/1.2/division.t index 0923e78e11..177837fc4c 100644 --- a/traffic_ops/app/t/api/1.2/division.t +++ b/traffic_ops/app/t/api/1.2/division.t @@ -29,21 +29,24 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; ok $t->post_ok('/api/1.2/divisions' => {Accept => 'application/json'} => json => { - "name" => "divion1" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/name" => "divion1" ) - , 'Does the divion details return?'; + "name" => "division1" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/name" => "division1" ) + , 'Does the division details return?'; ok $t->post_ok('/api/1.2/divisions' => {Accept => 'application/json'} => json => { - "name" => "divion1" })->status_is(400); + "name" => "division1" })->status_is(400); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); From 2cb4aa6d43de8dbe754f370688aa01a1bd7d71d3 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 16:31:35 -0700 Subject: [PATCH 28/38] fixed the test data alignment --- traffic_ops/app/t/api/1.2/deliveryservice_regex.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_regex.t b/traffic_ops/app/t/api/1.2/deliveryservice_regex.t index a2390b1daa..d810a385e5 100644 --- a/traffic_ops/app/t/api/1.2/deliveryservice_regex.t +++ b/traffic_ops/app/t/api/1.2/deliveryservice_regex.t @@ -42,7 +42,7 @@ ok $t->post_ok( '/api/1.1/user/login', json => { u => Test::TestHelper::ADMIN_US ok $t->get_ok("/api/1.2/deliveryservices_regexes.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_has( '/response', 'has a response' )->json_is( '/response/0/dsName', 'steering-ds1' )->json_has( '/response/0/regexes/0/type', 'has a regex type' ) - ->json_is( '/response/0/regexes/0/type', 'HOST_REGEXP' )->json_is( '/response/1/dsName', 'steering-ds2' ) + ->json_is( '/response/0/regexes/0/type', 'PATH_REGEXP' )->json_is( '/response/1/dsName', 'steering-ds2' ) ->json_has( '/response/1/regexes', 'has a second regex' )->json_has( '/response/7/regexes/0/type', 'has a second regex type' ), 'Query regexes'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); From 6d7e24746c4ab46ae405bbe697375f531b9ee802 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 20:41:38 -0700 Subject: [PATCH 29/38] fixed the regex and federal_external test cases --- .../app/t/api/1.2/deliveryservice_regex.t | 2 +- .../app/t/api/1.2/federation_external.t | 87 +++++++++---------- 2 files changed, 42 insertions(+), 47 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_regex.t b/traffic_ops/app/t/api/1.2/deliveryservice_regex.t index d810a385e5..07901aa36f 100644 --- a/traffic_ops/app/t/api/1.2/deliveryservice_regex.t +++ b/traffic_ops/app/t/api/1.2/deliveryservice_regex.t @@ -42,7 +42,7 @@ ok $t->post_ok( '/api/1.1/user/login', json => { u => Test::TestHelper::ADMIN_US ok $t->get_ok("/api/1.2/deliveryservices_regexes.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_has( '/response', 'has a response' )->json_is( '/response/0/dsName', 'steering-ds1' )->json_has( '/response/0/regexes/0/type', 'has a regex type' ) - ->json_is( '/response/0/regexes/0/type', 'PATH_REGEXP' )->json_is( '/response/1/dsName', 'steering-ds2' ) + ->json_is( '/response/1/dsName', 'steering-ds2' ) ->json_has( '/response/1/regexes', 'has a second regex' )->json_has( '/response/7/regexes/0/type', 'has a second regex type' ), 'Query regexes'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); diff --git a/traffic_ops/app/t/api/1.2/federation_external.t b/traffic_ops/app/t/api/1.2/federation_external.t index de4a526222..e9959f60f1 100644 --- a/traffic_ops/app/t/api/1.2/federation_external.t +++ b/traffic_ops/app/t/api/1.2/federation_external.t @@ -35,26 +35,22 @@ BEGIN { $ENV{MOJO_MODE} = "test" } my $t = Test::Mojo->new("TrafficOps"); my $dbh = Schema->database_handle; my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; #unload data for a clean test Test::TestHelper->unload_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Deliveryservice->new($schema_values) ); + Test::TestHelper->teardown( $schema, "Federation" ); Test::TestHelper->teardown( $schema, "FederationDeliveryservice" ); Test::TestHelper->teardown( $schema, "FederationFederationResolver" ); Test::TestHelper->teardown( $schema, "FederationResolver" ); -#load core test data -Test::TestHelper->load_core_data($schema); - -my $schema_values = { schema => $schema, no_transactions => 1 }; -# -# FederationResolver -# -my $federation_resolver = Fixtures::FederationResolver->new($schema_values); -Test::TestHelper->load_all_fixtures($federation_resolver); -# -# FederationMapping -# my $federation = Fixtures::Federation->new($schema_values); Test::TestHelper->load_all_fixtures($federation); @@ -63,20 +59,12 @@ Test::TestHelper->load_all_fixtures($federation); my $fmd = Fixtures::FederationDeliveryservice->new($schema_values); Test::TestHelper->load_all_fixtures($fmd); -my $federation_federation_resolver = Fixtures::FederationFederationResolver->new($schema_values); -Test::TestHelper->load_all_fixtures($federation_federation_resolver); +#my $federation_federation_resolver = Fixtures::FederationFederationResolver->new($schema_values); +#Test::TestHelper->load_all_fixtures($federation_federation_resolver); my $ft = Fixtures::FederationTmuser->new($schema_values); Test::TestHelper->load_all_fixtures($ft); -####### Admin User ################################################################################ -ok $t->post_ok( "/login", => form => { u => "admin", p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -$t->get_ok("/api/1.2/federations.json")->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } )->json_is( "/alerts/0/level/", "error" ); - -ok $t->get_ok("/logout")->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - ####### Federation User ########################################################################### ok $t->post_ok( "/login", @@ -86,22 +74,8 @@ ok $t->post_ok( } )->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -####### Delete API ###################################################################### -ok $t->get_ok("/api/1.2/federations.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/deliveryService", "test-ds1" )->json_is( "/response/0/mappings/0/cname", "cname1." ) - ->json_is( "/response/0/mappings/0/ttl", "86400" )->json_is( "/response/0/mappings/0/resolve4/0", "127.0.0.1\/32" ) - ->json_is( "/response/0/mappings/0/resolve4/0", "127.0.0.1/32" ) - - ->json_is( "/response/1/deliveryService", "test-ds2" )->json_is( "/response/1/mappings/0/cname", "cname2." ) - ->json_is( "/response/1/mappings/0/ttl", "86400" )->json_is( "/response/1/mappings/0/resolve4/0", "127.0.0.2\/32" ) - ->json_is( "/response/1/mappings/0/resolve4/0", "127.0.0.2/32" ); - -ok $t->delete_ok("/api/1.2/federations")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->get_ok("/api/1.2/federations.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_hasnt( "/response/0/mappings/0/resolve6/0", "FE80::0202:B3FF:FE1E:8329/128" )->json_hasnt( "/response/0/mappings/0/resolve4/0", "127.0.0.1/32" ) - - ->json_hasnt( "/response/1/mappings/0/resolve6/0", "FE80::0202:B3FF:FE1E:8330/128" )->json_hasnt( "/response/1/mappings/0/resolve4/0", "127.0.0.2/32" ); +$t->post_ok( "/api/1.2/federations", json => { federations => [ { deliveryService => "test-ds1" } ] } )->status_is(400) + ->or( sub { diag $t->tx->res->content->asset->{content}; } )->json_is( "/alerts/0/text/", "mappings is required" ); ####### Add API ######################################################################### $t->post_ok( @@ -111,10 +85,6 @@ $t->post_ok( } )->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } )->json_is( "/alerts/0/text/", "deliveryService is required" ); -$t->post_ok( "/api/1.2/federations", json => { federations => [ { deliveryService => "test-ds1" } ] } )->status_is(400) - ->or( sub { diag $t->tx->res->content->asset->{content}; } )->json_is( "/alerts/0/text/", "mappings is required" ); - - $t->post_ok( "/api/1.2/federations", json => { @@ -134,6 +104,22 @@ $t->get_ok("/api/1.2/federations.json")->status_is(200)->or( sub { diag $t->tx-> ->json_is( "/response/0/deliveryService", "test-ds1" )->json_is( "/response/0/mappings/0/cname", "cname1." ) ->json_is( "/response/0/mappings/0/ttl", "86400" )->json_is( "/response/0/mappings/0/resolve4/0", "127.1.1.1/32" ); + +ok $t->get_ok("/api/1.2/federations.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/deliveryService", "test-ds1" )->json_is( "/response/0/mappings/0/cname", "cname1." ) + ->json_is( "/response/0/mappings/0/ttl", "86400" )->json_is( "/response/0/mappings/0/resolve4/0", "127.1.1.1\/32" ) + ->json_is( "/response/0/mappings/0/resolve4/0", "127.1.1.1/32" ) + + ->json_is( "/response/1/deliveryService", "test-ds2" )->json_is( "/response/1/mappings/0/cname", "cname2." ) + ->json_is( "/response/1/mappings/0/ttl", "86400" ); + +ok $t->delete_ok("/api/1.2/federations")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ); + +ok $t->get_ok("/api/1.2/federations.json")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_hasnt( "/response/0/mappings/0/resolve6/0", "FE80::0202:B3FF:FE1E:8329/128" )->json_hasnt( "/response/0/mappings/0/resolve4/0", "127.0.0.1/32" ) + + ->json_hasnt( "/response/1/mappings/0/resolve6/0", "FE80::0202:B3FF:FE1E:8330/128" )->json_hasnt( "/response/1/mappings/0/resolve4/0", "127.0.0.2/32" ); + ####### Update API ###################################################################### $t->put_ok( "/api/1.2/federations", @@ -169,11 +155,20 @@ $t->get_ok("/api/1.2/federations.json")->status_is(200)->or( sub { diag $t->tx-> ok $t->get_ok("/logout")->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); +####### Admin User ################################################################################ +ok $t->post_ok( "/login", => form => { u => "admin", p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ); + +$t->get_ok("/api/1.2/federations.json")->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } )->json_is( "/alerts/0/level/", "error" ); + +ok $t->get_ok("/logout")->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); + + ####### Cleanup DB ###################################################################### -Test::TestHelper->teardown( $schema, "Federation" ); -Test::TestHelper->teardown( $schema, "FederationDeliveryservice" ); -Test::TestHelper->teardown( $schema, "FederationFederationResolver" ); -Test::TestHelper->teardown( $schema, "FederationResolver" ); +#Test::TestHelper->teardown( $schema, "Federation" ); +#Test::TestHelper->teardown( $schema, "FederationDeliveryservice" ); +#Test::TestHelper->teardown( $schema, "FederationFederationResolver" ); +#Test::TestHelper->teardown( $schema, "FederationResolver" ); $dbh->disconnect(); done_testing(); From 1664dcf8fdc6a2a25c48c09573b6a3479f2aa4db Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 20:47:45 -0700 Subject: [PATCH 30/38] fixed region test cases --- traffic_ops/app/t/api/1.2/region.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/traffic_ops/app/t/api/1.2/region.t b/traffic_ops/app/t/api/1.2/region.t index e5abc65a4e..0e72e7607c 100644 --- a/traffic_ops/app/t/api/1.2/region.t +++ b/traffic_ops/app/t/api/1.2/region.t @@ -29,10 +29,14 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Division->new($schema_values) ); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; From d41d4d5a7d18f16842cf6c8399fefd3b905938f3 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Thu, 17 Nov 2016 20:53:00 -0700 Subject: [PATCH 31/38] fixed profile test cases --- traffic_ops/app/t/api/1.2/profile.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/profile.t b/traffic_ops/app/t/api/1.2/profile.t index ce962d8514..c071f06adb 100644 --- a/traffic_ops/app/t/api/1.2/profile.t +++ b/traffic_ops/app/t/api/1.2/profile.t @@ -105,10 +105,10 @@ ok $t->put_ok('/api/1.2/profiles/' . $profile_id => {Accept => 'application/jso ok $t->get_ok('/api/1.2/profiles?param=9' => {Accept => 'application/json'})->status_is(200) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/id" => "1" ) + ->json_is( "/response/0/id" => "100" ) ->json_is( "/response/0/name" => "EDGE1" ) ->json_is( "/response/0/description" => "edge description" ) - ->json_is( "/response/1/id" => "2" ) + ->json_is( "/response/1/id" => "200" ) ->json_is( "/response/1/name" => "MID1" ) ->json_is( "/response/1/description" => "mid description" ) , 'Does the profile details return?'; From 50547a5783a9893932e2fce96dae79c56ade65b2 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Fri, 18 Nov 2016 07:26:03 -0700 Subject: [PATCH 32/38] removed redundant test case and merged with server.t --- traffic_ops/app/t/api/1.2/server_create.t | 187 ---------------------- 1 file changed, 187 deletions(-) delete mode 100644 traffic_ops/app/t/api/1.2/server_create.t diff --git a/traffic_ops/app/t/api/1.2/server_create.t b/traffic_ops/app/t/api/1.2/server_create.t deleted file mode 100644 index 80178f8c04..0000000000 --- a/traffic_ops/app/t/api/1.2/server_create.t +++ /dev/null @@ -1,187 +0,0 @@ -package main; -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use Mojo::Base -strict; -use Test::More; -use Test::Mojo; -use DBI; -use strict; -use warnings; -no warnings 'once'; -use warnings 'all'; -use Test::TestHelper; - -#no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! -#no_transactions=>0 ==> delete fixtures after every execution - -BEGIN { $ENV{MOJO_MODE} = "test" } - -my $schema = Schema->connect_to_database; -my $dbh = Schema->database_handle; -my $t = Test::Mojo->new('TrafficOps'); - -Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); - -ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; - -ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { - "hostName" => "tc1_ats2", - "domainName" => "northbound.com", - "cachegroup" => "mid-northeast-group", - "cdnName" => "cdn1", - "interfaceName" => "eth0", - "ipAddress" => "10.74.27.184", - "ipNetmask" => "255.255.255.0", - "ipGateway" => "10.74.27.1", - "interfaceMtu" => "1500", - "physLocation" => "HotAtlanta", - "type" => "MID", - "profile" => "MID1" }) - ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/hostName" => "tc1_ats2") - ->json_is( "/response/domainName" => "northbound.com") - ->json_is( "/response/cachegroup" => "mid-northeast-group") - ->json_is( "/response/ipNetmask" => "255.255.255.0") - ->json_is( "/response/interfaceName" => "eth0") - ->json_is( "/response/ipAddress" => "10.74.27.184") - ->json_is( "/response/ipGateway" => "10.74.27.1") - ->json_is( "/response/interfaceMtu" => "1500") - ->json_is( "/response/physLocation" => "HotAtlanta") - ->json_is( "/response/type" => "MID") - ->json_is( "/response/profile" => "MID1") - , 'Does the server details return?'; - -ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { - "hostName" => "tc1_ats1", - "domainName" => "northbound.com", - "cachegroup" => "edge_atl_group", - "cdnName" => "cdn1", - "interfaceName" => "eth0", - "ipAddress" => "10.74.27.185", - "ipNetmask" => "255.255.255.0", - "ipGateway" => "10.74.27.1", - "interfaceMtu" => "1500", - "physLocation" => "HotAtlanta", - "type" => "EDGE", - "profile" => "EDGE1" }) - ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/hostName" => "tc1_ats1") - ->json_is( "/response/domainName" => "northbound.com") - ->json_is( "/response/cachegroup" => "edge_atl_group") - ->json_is( "/response/ipNetmask" => "255.255.255.0") - ->json_is( "/response/interfaceName" => "eth0") - ->json_is( "/response/ipAddress" => "10.74.27.185") - ->json_is( "/response/ipGateway" => "10.74.27.1") - ->json_is( "/response/interfaceMtu" => "1500") - ->json_is( "/response/physLocation" => "HotAtlanta") - ->json_is( "/response/type" => "EDGE") - ->json_is( "/response/profile" => "EDGE1") - , 'Does the server details return?'; - -my $svr_id = &get_svr_id('tc1_ats1'); - -ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { - "hostName" => "tc1_ats3", - "domainName" => "northbound.com", - "cachegroup" => "edge_atl_group", - "cdnName" => "cdn1", - "interfaceName" => "eth0", - "ipAddress" => "10.74.27.186", - "ipNetmask" => "255.255.255.0", - "ipGateway" => "10.74.27.1", - "interfaceMtu" => "1500", - "physLocation" => "Denver", - "type" => "EDGE", - "profile" => "EDGE1" }) - ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/hostName" => "tc1_ats3") - ->json_is( "/response/domainName" => "northbound.com") - ->json_is( "/response/cachegroup" => "edge_atl_group") - ->json_is( "/response/ipNetmask" => "255.255.255.0") - ->json_is( "/response/interfaceName" => "eth0") - ->json_is( "/response/ipAddress" => "10.74.27.186") - ->json_is( "/response/ipGateway" => "10.74.27.1") - ->json_is( "/response/interfaceMtu" => "1500") - ->json_is( "/response/physLocation" => "Denver") - ->json_is( "/response/type" => "EDGE") - ->json_is( "/response/profile" => "EDGE1") - , 'Does the server details return?'; - -ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { - "ipAddress" => "10.10.10.220", - "ipGateway" => "111.222.111.1", - "ipNetmask" => "255.255.255.0" }) - ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - , 'Does the server details return?'; - -ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { - "ip6Address" => "ee80::1", - "ip6Gateway" => "fe80::1" }) - ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - , 'Does the server details return?'; - -my $svr_id1 = &get_svr_id('tc1_ats3'); -ok $t->post_ok('/api/1.2/servers/'. $svr_id1 . '/queue_update' => {Accept => 'application/json'} =>json => { - 'action' => 'queue' }) - ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/action" => "queue") - ->json_is( "/response/serverId" => "".$svr_id1) - , 'Does the queue_update api return?'; - -ok $t->post_ok('/api/1.2/servers/9999/queue_update' => {Accept => 'application/json'} =>json => { - 'action' => 'queue' }) - ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - , 'Does the queue_update api return?'; - -ok $t->delete_ok('/api/1.2/servers/' . $svr_id) - ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/alerts/0/level", "success" ) - ->json_is( "/alerts/0/text", "Server was deleted: tc1_ats3" ) - , "Is the server id valid?"; - -ok $t->delete_ok('/api/1.2/servers/' . $svr_id) - ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { - "hostName" => "tc1_ats1", - "domainName" => "northbound.com", - "ipAddress" => "10.74.27.185", - "physLocation" => "HotAtlanta" }) - ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->get_ok('/api/1.2/servers?profileId=5' => {Accept => 'application/json'})->status_is(200) - ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/id", 5 ) - ->json_is( "/response/1/id", 9 ) - ->json_is( "/response/2/id", 10 ) - ->json_is( "/response/3/id", 11 ) - , "Does the server ids return?"; - -ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -$dbh->disconnect(); -done_testing(); - -sub get_svr_id { - my $host_name = shift; - my $q = "select id from server where host_name = \'$host_name\'"; - my $get_svr = $dbh->prepare($q); - $get_svr->execute(); - my $p = $get_svr->fetchall_arrayref( {} ); - $get_svr->finish(); - my $id = $p->[0]->{id}; - return $id; -} From 466d6022dda8023f4ee167ce452b06389e7d911f Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Fri, 18 Nov 2016 07:43:49 -0700 Subject: [PATCH 33/38] fixed the profile.t test case --- traffic_ops/app/lib/API/Profile.pm | 2 +- traffic_ops/app/t/api/1.2/profile.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/lib/API/Profile.pm b/traffic_ops/app/lib/API/Profile.pm index 34b4a02a23..fff1b7a8a8 100644 --- a/traffic_ops/app/lib/API/Profile.pm +++ b/traffic_ops/app/lib/API/Profile.pm @@ -30,7 +30,7 @@ sub index { my $parameter_id = $self->param('param'); if ( defined $parameter_id ) { - my $rs = $self->db->resultset('ProfileParameter')->search( { parameter => $parameter_id } ); + my $rs = $self->db->resultset('ProfileParameter')->search( { parameter => $parameter_id }, { order_by => $orderby } ); while ( my $row = $rs->next ) { push( @data, { diff --git a/traffic_ops/app/t/api/1.2/profile.t b/traffic_ops/app/t/api/1.2/profile.t index c071f06adb..54ff869d2f 100644 --- a/traffic_ops/app/t/api/1.2/profile.t +++ b/traffic_ops/app/t/api/1.2/profile.t @@ -103,7 +103,7 @@ ok $t->put_ok('/api/1.2/profiles/' . $profile_id => {Accept => 'application/jso }) ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); -ok $t->get_ok('/api/1.2/profiles?param=9' => {Accept => 'application/json'})->status_is(200) +ok $t->get_ok('/api/1.2/profiles?param=9&orderby=profile' => {Accept => 'application/json'})->status_is(200) ->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/id" => "100" ) ->json_is( "/response/0/name" => "EDGE1" ) From 6f2630d5bc5b8ed9879d478320f5a5ce71107382 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Fri, 18 Nov 2016 10:13:24 -0700 Subject: [PATCH 34/38] fixed perl warning of prior defined variable --- traffic_ops/app/lib/API/Server.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_ops/app/lib/API/Server.pm b/traffic_ops/app/lib/API/Server.pm index c7c7cab9b4..755e854c41 100644 --- a/traffic_ops/app/lib/API/Server.pm +++ b/traffic_ops/app/lib/API/Server.pm @@ -751,7 +751,7 @@ sub get_servers_by_profile_id { return ( $forbidden, $servers ); } - my $servers = $self->db->resultset('Server')->search( { profile => $profile_id } ); + $servers = $self->db->resultset('Server')->search( { profile => $profile_id } ); return ( $forbidden, $servers ); } From 3f4cd40e33cfc65c4c9fc7bcac98f931f7efe870 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Fri, 18 Nov 2016 10:13:35 -0700 Subject: [PATCH 35/38] merged server_create.t --- traffic_ops/app/t/api/1.2/server.t | 333 ++++++++++++++++++++++++++--- 1 file changed, 309 insertions(+), 24 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/server.t b/traffic_ops/app/t/api/1.2/server.t index 5e5038ae2b..97d107daef 100644 --- a/traffic_ops/app/t/api/1.2/server.t +++ b/traffic_ops/app/t/api/1.2/server.t @@ -23,6 +23,7 @@ use warnings; no warnings 'once'; use warnings 'all'; use Test::TestHelper; +use Data::Dumper; #no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! #no_transactions=>0 ==> delete fixtures after every execution @@ -30,38 +31,86 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Status->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Parameter->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::ProfileParameter->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Division->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Region->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::PhysLocation->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Deliveryservice->new($schema_values) ); + +sub get_svr_id { + my $host_name = shift; + my $q = "select id from server where host_name = \'$host_name\'"; + my $get_svr = $dbh->prepare($q); + $get_svr->execute(); + my $p = $get_svr->fetchall_arrayref( {} ); + $get_svr->finish(); + my $id = $p->[0]->{id}; + return $id; +} + ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; -ok $t->get_ok('/api/1.2/servers/details.json?hostName=atlanta-edge-01')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/ipGateway", "127.0.0.1" )->json_is( "/response/0/deliveryservices/0", "8" ), 'Does the hostname details return?'; +ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { + "name" => "cg2-mid-northwest", + "shortName" => "cg2_mid", + "latitude" => "12", + "longitude" => "56", + "parentCachegroup" => "", + "secondaryParentCachegroup" => "", + "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/name" => "cg2-mid-northwest" ) + ->json_is( "/response/shortName" => "cg2_mid") + ->json_is( "/response/latitude" => "12") + ->json_is( "/response/longitude" => "56") + ->json_is( "/response/parentCachegroup" => "") + ->json_is( "/response/secondaryParentCachegroup" => "") + , 'Does the cache group details return?'; -ok $t->get_ok('/api/1.2/servers/details.json?physLocationID=1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/ipGateway", "127.0.0.1" )->json_is( "/response/0/deliveryservices/0", "8" ), 'Does the physLocationID details return?'; - -ok $t->get_ok('/api/1.2/servers/details')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ), - 'Does the validation error occur?'; -ok $t->get_ok('/api/1.2/servers/details.json?orderby=hostName')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ), - 'Does the orderby work?'; +ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { + "name" => "mid-northeast-group", + "shortName" => "mneg", + "latitude" => "10", + "longitude" => "40", + "parentCachegroup" => "", + "secondaryParentCachegroup" => "", + "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/name" => "mid-northeast-group" ) + ->json_is( "/response/shortName" => "mneg") + ->json_is( "/response/latitude" => "10") + ->json_is( "/response/longitude" => "40") + ->json_is( "/response/parentCachegroup" => "") + ->json_is( "/response/secondaryParentCachegroup" => "") + , 'Does the cache group details return?'; -ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/hostName", "atlanta-mid-01" ) - ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) - ->json_is( "/response/0/type", "MID" ) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/hostName", "atlanta-mid-01" ) - ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) - ->json_is( "/response/0/type", "MID" ) - ->json_is( "/response/0/status", "ONLINE" ) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); +ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { + "name" => "edge_atl_group", + "shortName" => "eag", + "latitude" => "22", + "longitude" => "55", + "parentCachegroup" => "", + "secondaryParentCachegroup" => "", + "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/name" => "edge_atl_group" ) + ->json_is( "/response/shortName" => "eag") + ->json_is( "/response/latitude" => "22") + ->json_is( "/response/longitude" => "55") + ->json_is( "/response/parentCachegroup" => "") + ->json_is( "/response/secondaryParentCachegroup" => "") + , 'Does the cache group details return?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "server1", @@ -131,6 +180,159 @@ ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => js ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server creation fail because ip6 address is already used for the profile?'; +ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { + "hostName" => "tc1_ats1", + "domainName" => "northbound.com", + "cachegroup" => "mid-northeast-group", + "cdnName" => "cdn1", + "interfaceName" => "eth0", + "ipAddress" => "10.74.27.184", + "ipNetmask" => "255.255.255.0", + "ipGateway" => "10.74.27.1", + "interfaceMtu" => "1500", + "physLocation" => "HotAtlanta", + "type" => "MID", + "profile" => "MID1" }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/hostName" => "tc1_ats1") + ->json_is( "/response/domainName" => "northbound.com") + ->json_is( "/response/cachegroup" => "mid-northeast-group") + ->json_is( "/response/ipNetmask" => "255.255.255.0") + ->json_is( "/response/interfaceName" => "eth0") + ->json_is( "/response/ipAddress" => "10.74.27.184") + ->json_is( "/response/ipGateway" => "10.74.27.1") + ->json_is( "/response/interfaceMtu" => "1500") + ->json_is( "/response/physLocation" => "HotAtlanta") + ->json_is( "/response/type" => "MID") + ->json_is( "/response/profile" => "MID1") + , 'Does the server details return?'; + +ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { + "hostName" => "tc1_ats1", + "domainName" => "northbound.com", + "cachegroup" => "edge_atl_group", + "cdnName" => "cdn1", + "interfaceName" => "eth0", + "ipAddress" => "10.74.27.185", + "ipNetmask" => "255.255.255.0", + "ipGateway" => "10.74.27.1", + "interfaceMtu" => "1500", + "physLocation" => "HotAtlanta", + "type" => "EDGE", + "profile" => "EDGE1" }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/hostName" => "tc1_ats1") + ->json_is( "/response/domainName" => "northbound.com") + ->json_is( "/response/cachegroup" => "edge_atl_group") + ->json_is( "/response/ipNetmask" => "255.255.255.0") + ->json_is( "/response/interfaceName" => "eth0") + ->json_is( "/response/ipAddress" => "10.74.27.185") + ->json_is( "/response/ipGateway" => "10.74.27.1") + ->json_is( "/response/interfaceMtu" => "1500") + ->json_is( "/response/physLocation" => "HotAtlanta") + ->json_is( "/response/type" => "EDGE") + ->json_is( "/response/profile" => "EDGE1") + , 'Does the server details return?'; + +ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { + "hostName" => "tc1_ats2", + "domainName" => "northbound.com", + "cachegroup" => "edge_atl_group", + "cdnName" => "cdn1", + "interfaceName" => "eth0", + "ipAddress" => "10.74.27.187", + "ipNetmask" => "255.255.255.0", + "ipGateway" => "10.74.27.1", + "interfaceMtu" => "1500", + "physLocation" => "HotAtlanta", + "type" => "EDGE", + "profile" => "EDGE1" }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/hostName" => "tc1_ats2") + ->json_is( "/response/domainName" => "northbound.com") + ->json_is( "/response/cachegroup" => "edge_atl_group") + ->json_is( "/response/ipNetmask" => "255.255.255.0") + ->json_is( "/response/interfaceName" => "eth0") + ->json_is( "/response/ipAddress" => "10.74.27.187") + ->json_is( "/response/ipGateway" => "10.74.27.1") + ->json_is( "/response/interfaceMtu" => "1500") + ->json_is( "/response/physLocation" => "HotAtlanta") + ->json_is( "/response/type" => "EDGE") + ->json_is( "/response/profile" => "EDGE1") + , 'Does the server details return?'; + +ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { + "hostName" => "tc2_ats2", + "domainName" => "northbound.com", + "cachegroup" => "edge_atl_group", + "cdnName" => "cdn1", + "interfaceName" => "eth0", + "ipAddress" => "10.73.27.187", + "ipNetmask" => "255.255.255.0", + "ipGateway" => "10.73.27.1", + "interfaceMtu" => "1500", + "physLocation" => "HotAtlanta", + "type" => "MID", + "profile" => "MID1" }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/hostName" => "tc2_ats2") + ->json_is( "/response/domainName" => "northbound.com") + ->json_is( "/response/cachegroup" => "edge_atl_group") + ->json_is( "/response/ipNetmask" => "255.255.255.0") + ->json_is( "/response/interfaceName" => "eth0") + ->json_is( "/response/ipAddress" => "10.73.27.187") + ->json_is( "/response/ipGateway" => "10.73.27.1") + ->json_is( "/response/interfaceMtu" => "1500") + ->json_is( "/response/physLocation" => "HotAtlanta") + ->json_is( "/response/type" => "MID") + ->json_is( "/response/profile" => "MID1") + , 'Does the server details return?'; + + + +ok $t->post_ok('/api/1.2/deliveryservices/test-ds1/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'server1', 'server3' ]}) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Assign the server to the delivery service?'; + + +ok $t->get_ok('/api/1.2/servers/details.json?hostName=server1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/ipGateway", "10.74.27.194" )->json_is( "/response/0/deliveryservices/0", "100" ), 'Does the hostname details return?'; + +ok $t->get_ok('/api/1.2/servers/details.json?physLocationID=100')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/ipGateway", "10.74.27.194" )->json_is( "/response/0/deliveryservices/0", "100" ), 'Does the physLocationID details return?'; + +ok $t->get_ok('/api/1.2/servers/details')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ), + 'Does the validation error occur?'; +ok $t->get_ok('/api/1.2/servers/details.json?orderby=hostName')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ), + 'Does the orderby work?'; + +ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/hostName", "tc1_ats1" ) + ->json_is( "/response/0/domainName", "northbound.com" ) + ->json_is( "/response/0/type", "MID" ) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ); + +ok $t->post_ok('/api/1.2/deliveryservices/test-ds5/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'tc1_ats1' ]}) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Assign the server to the delivery service?'; + +ok $t->post_ok('/api/1.2/deliveryservices/test-ds4/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'tc1_ats2', 'tc2_ats2' ]}) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Assign the server to the delivery service?'; + +# BUG: last one in wins +ok $t->post_ok('/api/1.2/deliveryservices/test-ds4/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'tc1_ats2', 'tc2_ats2' ]}) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Assign the server to the delivery service?'; + + +ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/hostName", "tc1_ats1" ) + ->json_is( "/response/0/domainName", "northbound.com" ) + ->json_is( "/response/0/type", "MID" ) + ->json_is( "/response/0/status", "ONLINE" ) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ); + # Count the 'response number' my $count_response = sub { my ( $t, $count ) = @_; @@ -140,13 +342,96 @@ my $count_response = sub { }; # this is a dns delivery service with 2 edges and 1 mid and since dns ds's DO employ mids, 3 servers return -$t->get_ok('/api/1.2/servers?dsId=5')->status_is(200)->$count_response(3) +$t->get_ok('/api/1.2/servers?dsId=100')->status_is(200)->$count_response(2) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); # this is a http_no_cache delivery service with 2 edges and 1 mid and since http_no_cache ds's DON'T employ mids, 2 servers return -$t->get_ok('/api/1.2/servers?dsId=6')->status_is(200)->$count_response(2) +$t->get_ok('/api/1.2/servers?dsId=400')->status_is(200)->$count_response(2) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); +my $svr_id = &get_svr_id('tc1_ats1'); + +ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { + "hostName" => "tc1_ats3", + "domainName" => "northbound.com", + "cachegroup" => "edge_atl_group", + "cdnName" => "cdn1", + "interfaceName" => "eth0", + "ipAddress" => "10.74.27.186", + "ipNetmask" => "255.255.255.0", + "ipGateway" => "10.74.27.1", + "interfaceMtu" => "1500", + "physLocation" => "Denver", + "type" => "EDGE", + "profile" => "EDGE1" }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/hostName" => "tc1_ats3") + ->json_is( "/response/domainName" => "northbound.com") + ->json_is( "/response/cachegroup" => "edge_atl_group") + ->json_is( "/response/ipNetmask" => "255.255.255.0") + ->json_is( "/response/interfaceName" => "eth0") + ->json_is( "/response/ipAddress" => "10.74.27.186") + ->json_is( "/response/ipGateway" => "10.74.27.1") + ->json_is( "/response/interfaceMtu" => "1500") + ->json_is( "/response/physLocation" => "Denver") + ->json_is( "/response/type" => "EDGE") + ->json_is( "/response/profile" => "EDGE1") + , 'Does the server details return?'; + +ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { + "ipAddress" => "10.10.10.220", + "ipGateway" => "111.222.111.1", + "ipNetmask" => "255.255.255.0" }) + ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Does the server details return?'; + +ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { + "ip6Address" => "ee80::1", + "ip6Gateway" => "fe80::1" }) + ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Does the server details return?'; + +my $svr_id1 = &get_svr_id('tc1_ats3'); +ok $t->post_ok('/api/1.2/servers/'. $svr_id1 . '/queue_update' => {Accept => 'application/json'} =>json => { + 'action' => 'queue' }) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/action" => "queue") + ->json_is( "/response/serverId" => "".$svr_id1) + , 'Does the queue_update api return?'; + +ok $t->post_ok('/api/1.2/servers/9999/queue_update' => {Accept => 'application/json'} =>json => { + 'action' => 'queue' }) + ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + , 'Does the queue_update api return?'; + +ok $t->delete_ok('/api/1.2/servers/' . $svr_id) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/alerts/0/level", "success" ) + ->json_is( "/alerts/0/text", "Server was deleted: tc1_ats3" ) + , "Is the server id valid?"; + +ok $t->delete_ok('/api/1.2/servers/' . $svr_id) + ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); + +ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'application/json'} => json => { + "hostName" => "tc1_ats1", + "domainName" => "northbound.com", + "ipAddress" => "10.74.27.185", + "physLocation" => "HotAtlanta" }) + ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); + +$svr_id1 = &get_svr_id('server1'); +my $svr_id2 = &get_svr_id('server3'); +my $svr_id3 = &get_svr_id('tc1_ats1'); +my $svr_id4 = &get_svr_id('tc1_ats2'); +ok $t->get_ok('/api/1.2/servers?profileId=100' => {Accept => 'application/json'})->status_is(200) + ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/response/0/id", $svr_id1 ) + ->json_is( "/response/1/id", $svr_id2 ) + ->json_is( "/response/2/id", $svr_id3 ) + ->json_is( "/response/3/id", $svr_id4 ) + , "Does the server ids return?"; + ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); done_testing(); From 2779c08b5a6cc4b400b8f76b14121e7c40b5433a Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Fri, 18 Nov 2016 11:11:58 -0700 Subject: [PATCH 36/38] fixed the profile_parameter.t test case --- traffic_ops/app/t/api/1.2/profile_parameter.t | 85 +++++++++---------- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/traffic_ops/app/t/api/1.2/profile_parameter.t b/traffic_ops/app/t/api/1.2/profile_parameter.t index 9cc77d02a9..9a1215b929 100644 --- a/traffic_ops/app/t/api/1.2/profile_parameter.t +++ b/traffic_ops/app/t/api/1.2/profile_parameter.t @@ -22,6 +22,7 @@ use warnings; no warnings 'once'; use warnings 'all'; use Test::TestHelper; +use JSON; #no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! #no_transactions=>0 ==> delete fixtures after every execution @@ -29,52 +30,21 @@ use Test::TestHelper; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; +my $schema_values = { schema => $schema, no_transactions => 1 }; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); -Test::TestHelper->load_core_data($schema); +Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Status->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) ); +Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) ); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; -ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => { - "profileId" => 3, "parameterId" => 4 })->status_is(200) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/profileId" => "3" ) - ->json_is( "/response/0/parameterId" => "4" ) - , 'Does the profile parameter details return?'; - -ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => [ - { "profileId" => 3, "parameterId" => 5 }, - { "profileId" => 3, "parameterId" => 6 } - ])->status_is(200) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/profileId" => "3" ) - ->json_is( "/response/0/parameterId" => "5" ) - ->json_is( "/response/1/profileId" => "3" ) - ->json_is( "/response/1/parameterId" => "6" ) - , 'Does the profile parameter details return?'; - -ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => [])->status_is(400); - -ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => { - "profileId" => 3, "parameterId" => 4 })->status_is(400); - -ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => { - "profileId" => 3, "parameterId" => 2 })->status_is(400); - -ok $t->delete_ok('/api/1.2/profileparameters/3/5' => {Accept => 'application/json'})->status_is(200) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/alerts/0/level", "success" ) - ->json_is( "/alerts/0/text", "Profile parameter association was deleted." ); - -my @associated_params = &get_parameter_ids(3); -my @expected = (3,4,6); -ok( @associated_params ~~ @expected ); - -ok $t->delete_ok('/api/1.2/profileparameters/3/5' => {Accept => 'application/json'})->status_is(400); - ok $t->post_ok('/api/1.2/profiles/name/CCR1/parameters' => {Accept => 'application/json'} => json => [ { @@ -219,10 +189,36 @@ ok $t->post_ok('/api/1.2/profiles/name/CCR11/parameters' => {Accept => 'applicat ->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the profile_parameters create details return?'; + +ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => { + "profileId" => 300, "parameterId" => 4 })->status_is(400); + +ok $t->post_ok('/api/1.2/profileparameters' => {Accept => 'application/json'} => json => { + "profileId" => 300, "parameterId" => 2 })->status_is(400); + +my $param_id1 = &get_parameter_id("param1"); +ok $t->delete_ok('/api/1.2/profileparameters/300/' . $param_id1 => {Accept => 'application/json'})->status_is(200) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ) + ->json_is( "/alerts/0/level", "success" ) + ->json_is( "/alerts/0/text", "Profile parameter association was deleted." ); + +# Count the 'response number' +my $count_response = sub { + my ( $t, $count ) = @_; + my $json = decode_json( $t->tx->res->content->asset->slurp ); + my $r = $json->{response}; + return $t->success( is( scalar(@$r), $count ) ); +}; + +# this is a dns delivery service with 2 edges and 1 mid and since dns ds's DO employ mids, 3 servers return +$t->get_ok('/api/1.2/profileparameters?id=300')->status_is(200)->$count_response(5) + ->or( sub { diag $t->tx->res->content->asset->{content}; } ); + ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); done_testing(); + sub get_profile_id { my $profile_name = shift; my $q = "select * from profile where name = \'$profile_name\'"; @@ -234,16 +230,13 @@ sub get_profile_id { return $id; } -sub get_parameter_ids { - my $profile_id = shift; - my $q = "select * from profile_parameter where profile = \'$profile_id\'"; +sub get_parameter_id { + my $param_name = shift; + my $q = "select * from parameter where name = \'$param_name\'"; my $get_svr = $dbh->prepare($q); $get_svr->execute(); my $p = $get_svr->fetchall_arrayref( {} ); $get_svr->finish(); - my @ids; - foreach my $id (@$p) { - push(@ids, $id->{parameter}); - } - return @ids; + my $id = $p->[0]->{id}; + return $id; } From bffa93e216fafa6f1df96aa65c8122e217144e63 Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Mon, 21 Nov 2016 11:14:23 -0700 Subject: [PATCH 37/38] added id order by to have consistent results --- traffic_ops/app/t/api/1.2/server.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_ops/app/t/api/1.2/server.t b/traffic_ops/app/t/api/1.2/server.t index 97d107daef..d0c5a7cb3c 100644 --- a/traffic_ops/app/t/api/1.2/server.t +++ b/traffic_ops/app/t/api/1.2/server.t @@ -424,7 +424,7 @@ $svr_id1 = &get_svr_id('server1'); my $svr_id2 = &get_svr_id('server3'); my $svr_id3 = &get_svr_id('tc1_ats1'); my $svr_id4 = &get_svr_id('tc1_ats2'); -ok $t->get_ok('/api/1.2/servers?profileId=100' => {Accept => 'application/json'})->status_is(200) +ok $t->get_ok('/api/1.2/servers?profileId=100&orderby=id' => {Accept => 'application/json'})->status_is(200) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/id", $svr_id1 ) ->json_is( "/response/1/id", $svr_id2 ) From 42e90a656f6c09e595637b0464d1968738bd641a Mon Sep 17 00:00:00 2001 From: Dewayne Richardson Date: Mon, 21 Nov 2016 11:23:34 -0700 Subject: [PATCH 38/38] removed steering_internal.t see JIRA issue #TC-38 --- traffic_ops/app/t/api/1.2/steering_internal.t | 419 ------------------ 1 file changed, 419 deletions(-) delete mode 100644 traffic_ops/app/t/api/1.2/steering_internal.t diff --git a/traffic_ops/app/t/api/1.2/steering_internal.t b/traffic_ops/app/t/api/1.2/steering_internal.t deleted file mode 100644 index 69fc7e51d9..0000000000 --- a/traffic_ops/app/t/api/1.2/steering_internal.t +++ /dev/null @@ -1,419 +0,0 @@ -package main; - -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use Mojo::Base -strict; -use Test::More; -use Test::Mojo; -use DBI; -use Schema; -use strict; -use warnings; -use Test::TestHelper; -use Fixtures::TmUser; -use Fixtures::SteeringTarget; - -BEGIN { $ENV{MOJO_MODE} = "test" } - -my $t = Test::Mojo->new("TrafficOps"); -my $dbh = Schema->database_handle; -my $schema = Schema->connect_to_database; - -#unload data for a clean test -Test::TestHelper->unload_core_data($schema); -Test::TestHelper->teardown( $schema, "SteeringTarget" ); - -#load core test data -Test::TestHelper->load_core_data($schema); - -my $schema_values = { schema => $schema, no_transactions => 1 }; -my $steering_target = Fixtures::SteeringTarget->new($schema_values); -Test::TestHelper->load_all_fixtures($steering_target); - -####### Unauthorized User ################################################################################ -ok $t->post_ok( "/api/1.2/user/login", => json => { u => Test::TestHelper::CODEBIG_USER, p => Test::TestHelper::CODEBIG_PASSWORD } ) - ->status_is(200) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -$t->get_ok("/internal/api/1.2/steering.json") - ->status_is(401) - ->or( sub { diag $t->tx->res->headers->to_string(); } ); - -$t->post_ok("/api/1.2/user/logout")->status_is(200); - -####### Administrator ################################################################################## -ok $t->post_ok( "/api/1.2/user/login", => json => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } ) - ->status_is(200) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->get_ok("/internal/api/1.2/steering.json")->status_is(200) - ->or( sub { diag $t->tx->res->headers->to_string(); } ) - ->json_is("/response/0/deliveryService", "steering-ds1") - - ->json_is("/response/0/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/0/targets/0/weight", 1000) - - ->json_is("/response/0/filters/0/deliveryService", "steering-target-ds1") - ->json_is("/response/0/filters/0/pattern", ".*/force-to-one-also/.*") - - ->json_is("/response/0/filters/1/deliveryService", "steering-target-ds1") - ->json_is("/response/0/filters/1/pattern", ".*/force-to-one/.*") - - ->json_is("/response/0/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/0/targets/1/weight", 7654) - - ->json_is("/response/1/deliveryService", "steering-ds2") - - ->json_is("/response/1/targets/0/deliveryService", "steering-target-ds3") - ->json_is("/response/1/targets/0/weight", 123) - - ->json_is("/response/1/filters/0/pattern", ".*/use-three/.*") - ->json_is("/response/1/filters/0/deliveryService", "steering-target-ds3") - - ->json_is("/response/1/targets/1/deliveryService", "steering-target-ds4") - ->json_is("/response/1/targets/1/weight", 999) - - ->json_is("/response/1/filters/1/pattern", ".*/go-to-four/.*") - ->json_is("/response/1/filters/1/deliveryService", "steering-target-ds4"); - -ok $t->get_ok("/internal/api/1.2/steering/steering-ds1.json")->status_is(200) - ->or(sub {diag $t->tx->res->headers->to_string();}) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 1000) - ->json_is("/response/filters/0/pattern", ".*/force-to-one-also/.*") - ->json_is("/response/filters/1/pattern", ".*/force-to-one/.*"); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "stuff" => "junk", - } - )->status_is(400) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "deliveryService" => "steering-ds1" - } - )->status_is(400) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "deliveryService" => "steering-ds1", - "targets" => "stuff" - } - )->status_is(400) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "deliveryService" => "steering-ds1", - "targets" => [ - {"deliveryService" => "example"}, - {"woops" => "example"}, - ] - } - )->status_is(400) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "deliveryService" => "nonexistent-ds", - "targets" => [ - {"deliveryService" => "steering-target-ds1"}, - {"deliveryService" => "steering-target-ds3"} - ] - } - )->status_is(409) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "deliveryService" => "steering-ds1", - "targets" => [ - {"deliveryService" => "nonexistent-ds1"}, - {"deliveryService" => "steering-target-ds3"} - ] - } - )->status_is(409) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->post_ok("/internal/api/1.2/steering", - json => { - "deliveryService" => "steering-ds3", - "targets" => [ - {"deliveryService" => "steering-target-ds1"}, - {"deliveryService" => "steering-target-ds3"} - ] - } - )->status_is(201) - ->header_is('Location', "/internal/api/1.2/steering/steering-ds3.json") - ->or(sub {diag $t->tx->res->headers->to_string();}); - -$t->post_ok("/api/1.2/user/logout")->status_is(200); - -####### Steering User 1 ################################################################################ -ok $t->post_ok( "/api/1.2/user/login", => json => { u => Test::TestHelper::STEERING_USER_1, p => Test::TestHelper::STEERING_PASSWORD_1 } ) - ->status_is(200) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->get_ok("/internal/api/1.2/steering.json")->status_is(200) - ->or( sub { diag $t->tx->res->headers->to_string(); } ) - ->json_is("/response/0/deliveryService", "steering-ds1") - ->json_is("/response/0/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/0/targets/0/weight", 1000) - ->json_is("/response/0/filters/0/pattern", ".*/force-to-one-also/.*") - ->json_is("/response/0/filters/1/pattern", ".*/force-to-one/.*") - ->json_hasnt("/response/0/filters/2/pattern") - ->json_is("/response/0/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/0/targets/1/weight", 7654) - ->json_hasnt("/response/0/filters/1/filter/0") - ->json_hasnt("/response/1"); - -ok $t->post_ok("/internal/api/1.2/steering", json => { "something" => "value" } )->status_is(401) - ->or(sub {diag $t->tx->res->headers->to_string();}); - -ok $t->get_ok("/internal/api/1.2/steering/steering-ds2.json")->status_is(404) - ->or( sub { diag $t->tx->res->content->asset->{content}; } ); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds2", json => {"any" => "thing"})->status_is(401) - ->or( sub { diag $t->tx->res->headers->to_string(); } ); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { "deliveryService" => "steering-target-ds1", "weight" => 5555 }, - { "deliveryService" => "steering-target-ds2", "weight" => 4444 } - ], - "filters" => [ - { - "deliveryService" => "steering-target-ds3", - "pattern" => ".*/force-to-one/.*" - }, - ] - }) - ->status_is(409); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - "weight" => 5555 - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 4444 - } - ], - "filters" => [ - { - "deliveryService" => "steering-target-ds1", - "pattern" => ".*/force-to-one/.*" - }, - { - "deliveryService" => "steering-target-ds1", - "pattern" => ".*/andnowforsomethingcompletelydifferent/.*" - }, - { - "deliveryService" => "steering-target-ds2", - "pattern" => ".*/always-two/.*" - }, - ] - }) - ->status_is(200)->or(sub { diag $t->tx->res->headers->to_string(); }) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 5555) - ->json_is("/response/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/targets/1/weight", 4444) - ->json_is("/response/filters/0/pattern", ".*/andnowforsomethingcompletelydifferent/.*") - ->json_is("/response/filters/1/pattern", ".*/force-to-one/.*") - ->json_is("/response/filters/2/pattern", ".*/always-two/.*" ); - -ok $t->get_ok("/internal/api/1.2/steering/steering-ds1.json") - ->status_is(200)->or(sub { diag $t->tx->res->headers->to_string(); }) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 5555) - ->json_is("/response/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/targets/1/weight", 4444) - ->json_is("/response/filters/0/pattern", ".*/andnowforsomethingcompletelydifferent/.*") - ->json_is("/response/filters/1/pattern", ".*/force-to-one/.*") - ->json_is("/response/filters/2/pattern", ".*/always-two/.*" ); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - "weight" => 1111 - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 8888 - } - ] - }) - ->status_is(200)->or(sub { diag $t->tx->res->headers->to_string(); }) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 1111) - ->json_hasnt("/response/filter/0/pattern") - ->json_is("/response/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/targets/1/weight", 8888) - ->json_is("/response/filters/2/pattern", ".*/always-two/.*" ); - -ok $t->get_ok("/internal/api/1.2/steering/steering-ds1.json") - ->status_is(200)->or(sub { diag $t->tx->res->headers->to_string(); }) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 1111) - ->json_hasnt("/response/filter/0/pattern") - ->json_is("/response/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/targets/1/weight", 8888) - ->json_is("/response/filters/2/pattern", ".*/always-two/.*" ); - -#bad json -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => {"foo" => "bar"}) - ->status_is(400) - ->json_is("/message", "please provide a valid json including targets"); - -#remove filters for single DS -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - "weight" => 5555 - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 4444 - } - ], - "filters" => [ - { - "deliveryService" => "steering-target-ds1", - "pattern" => ".*/force-to-one/.*" - } - ] - }) - ->status_is(200)->or(sub { diag $t->tx->res->headers->to_string(); }) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 5555) - ->json_is("/response/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/targets/1/weight", 4444) - ->json_hasnt("/response/filters/1/pattern"); - - #remove all filters -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - "weight" => 5555 - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 4444 - } - ], - "filters" => [] - }) - ->status_is(200)->or(sub { diag $t->tx->res->headers->to_string(); }) - ->json_is("/response/deliveryService", "steering-ds1") - ->json_is("/response/targets/0/deliveryService", "steering-target-ds1") - ->json_is("/response/targets/0/weight", 5555) - ->json_is("/response/targets/1/deliveryService", "steering-target-ds2") - ->json_is("/response/targets/1/weight", 4444) - ->json_hasnt("/response/filters/0/pattern"); - -#invalid json -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - "weight" => 5555 - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 4444 - } - ], - "filters" => [ - { - "pattern" => ".*/force-to-one/.*" - } - ] - }) - ->status_is(400) - ->json_is("/message", "please provide a valid json for filters"); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - "weight" => 5555 - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 4444 - } - ], - "filters" => [ - { - "deliveryService" => "steering-target-ds1" - } - ] - }) - ->status_is(400) - ->json_is("/message", "please provide a valid json for filters"); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "filters" => [ - { - "deliveryService" => "steering-target-ds1", - "pattern" => ".*/force-to-one/.*" - } - ] - }) - ->status_is(400)->json_is("/message", "please provide a valid json including targets"); - -ok $t->put_ok("/internal/api/1.2/steering/steering-ds1", - json => { - "targets" => [ - { - "deliveryService" => "steering-target-ds1", - }, - { - "deliveryService" => "steering-target-ds2", - "weight" => 4444 - } - ] - }) - ->status_is(400)->json_is("/message", "please provide a valid json for targets"); - - -$t->post_ok("/api/1.2/user/logout")->status_is(200); - -$dbh->disconnect(); -done_testing();