This is an automated email from the ASF dual-hosted git repository.

rshah pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 608c78e413f6e5d550be1a046587911f42266386
Author: Rima Shah <[email protected]>
AuthorDate: Mon Dec 4 14:44:57 2023 -0700

    * Fix the assignment of a delivery service to a server, to respect 
capabilities
    
    * fixing Traffic Portal to account for the correct field names
    
    * adding org server edge case
---
 CHANGELOG.md                                              |  5 +++++
 lib/go-tc/deliveryservice_servers.go                      |  1 +
 .../testing/api/v3/servers_id_deliveryservices_test.go    |  2 +-
 .../testing/api/v4/servers_id_deliveryservices_test.go    |  2 +-
 .../testing/api/v5/cachegroupsdeliveryservices_test.go    |  4 +---
 .../testing/api/v5/servers_id_deliveryservices_test.go    |  2 +-
 .../traffic_ops_golang/deliveryservice/servers/servers.go | 15 +++++++++++++--
 .../traffic_ops_golang/server/servers_assignment.go       |  2 +-
 .../TableAssignDSServersController.js                     |  2 +-
 traffic_portal/conf/configDev.js                          | 14 +++++++-------
 traffic_portal/test/integration/config.json               |  6 +++---
 11 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fcb5b74085..c745990c27 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 ### Changed
 - [#7614](https://github.com/apache/trafficcontrol/pull/7614) *Traffic Ops* 
The database upgrade process no longer overwrites changes users may have made 
to the initially seeded data.
 - [#7832](https://github.com/apache/trafficcontrol/pull/7832) *t3c* Removed 
perl dependency
+- Updated the CacheGroups Traffic Portal page to use a more performant 
AG-Grid-based table.
+
+### Fixed
+- [#7846](https://github.com/apache/trafficcontrol/pull/7846) *Traffic Portal* 
Increase State character limit
 
 ## [8.0.0] - 2023-09-20
 ### Added
@@ -93,6 +97,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#7814](https://github.com/apache/trafficcontrol/issues/7814) All Go 
components: Updated the module path to 
[`github.com/apache/trafficcontrol/v8`](https://pkg.go.dev/github.com/apache/trafficcontrol/v8).
 Module https://pkg.go.dev/github.com/apache/trafficcontrol will not receive 
further updates.
 
 ### Fixed
+- [#7878](https://github.com/apache/trafficcontrol/pull/7878) *Traffic Ops, 
Traffic Portal*: Fixed the case where TO was failing to assign delivery 
services to a server, due to a bug in the way the list of preexisting delivery 
services was being returned.
 - [#7819](https://github.com/apache/trafficcontrol/pull/7819) *Traffic Ops*: 
API v5 routes should not use `privLevel` comparisons.
 - [#7802](https://github.com/apache/trafficcontrol/pull/7802) *Traffic Control 
Health Client*: Fixed ReadMe.md typos and duplicates.
 - [#7764](https://github.com/apache/trafficcontrol/pull/7764) *Traffic Ops*: 
Collapsed DB migrations.
diff --git a/lib/go-tc/deliveryservice_servers.go 
b/lib/go-tc/deliveryservice_servers.go
index 773a60ccc0..93d5fdc0b5 100644
--- a/lib/go-tc/deliveryservice_servers.go
+++ b/lib/go-tc/deliveryservice_servers.go
@@ -430,6 +430,7 @@ func (server DSServerV4) Upgrade() DSServerV5 {
                        MgmtIPGateway:      server.MgmtIPGateway,
                        MgmtIPNetmask:      server.MgmtIPNetmask,
                        OfflineReason:      server.OfflineReason,
+                       Profiles:           server.ProfileNames,
                        PhysicalLocation:   
util.CoalesceToDefault(server.PhysLocation),
                        PhysicalLocationID: 
util.CoalesceToDefault(server.PhysLocationID),
                        Rack:               server.Rack,
diff --git a/traffic_ops/testing/api/v3/servers_id_deliveryservices_test.go 
b/traffic_ops/testing/api/v3/servers_id_deliveryservices_test.go
index 972097252c..592df8d4da 100644
--- a/traffic_ops/testing/api/v3/servers_id_deliveryservices_test.go
+++ b/traffic_ops/testing/api/v3/servers_id_deliveryservices_test.go
@@ -182,7 +182,7 @@ func validateServersDeliveryServicesPost(serverID int, 
expectedDSID []int, expec
        return func(t *testing.T, _ toclientlib.ReqInf, resp interface{}, _ 
tc.Alerts, _ error) {
                serverDeliveryServices, _, err := 
TOSession.GetServerIDDeliveryServicesWithHdr(serverID, nil)
                assert.RequireNoError(t, err, "Error getting Server Delivery 
Services: %v", err)
-               assert.RequireEqual(t, expectedDSCount, 
len(serverDeliveryServices), "Expected one Delivery Service returned Got: %d", 
len(serverDeliveryServices))
+               assert.RequireEqual(t, expectedDSCount, 
len(serverDeliveryServices), "Expected %d Delivery Service returned Got: %d", 
expectedDSCount, len(serverDeliveryServices))
                for i := 0; i < len(expectedDSID); i++ {
                        validateServersDeliveryServices(expectedDSID[i])(t, 
toclientlib.ReqInf{}, serverDeliveryServices, tc.Alerts{}, nil)
                }
diff --git a/traffic_ops/testing/api/v4/servers_id_deliveryservices_test.go 
b/traffic_ops/testing/api/v4/servers_id_deliveryservices_test.go
index 49e38eb314..594fd52aaf 100644
--- a/traffic_ops/testing/api/v4/servers_id_deliveryservices_test.go
+++ b/traffic_ops/testing/api/v4/servers_id_deliveryservices_test.go
@@ -193,7 +193,7 @@ func validateServersDeliveryServicesPost(serverID int, 
expectedDSID []int, expec
        return func(t *testing.T, _ toclientlib.ReqInf, resp interface{}, _ 
tc.Alerts, _ error) {
                serverDeliveryServices, _, err := 
TOSession.GetServerIDDeliveryServices(serverID, client.RequestOptions{})
                assert.RequireNoError(t, err, "Error getting Server Delivery 
Services: %v - alerts: %+v", err, serverDeliveryServices.Alerts)
-               assert.RequireEqual(t, expectedDSCount, 
len(serverDeliveryServices.Response), "Expected Two Delivery Service returned 
Got: %d", len(serverDeliveryServices.Response))
+               assert.RequireEqual(t, expectedDSCount, 
len(serverDeliveryServices.Response), "Expected %d Delivery Service returned 
Got: %d", expectedDSCount, len(serverDeliveryServices.Response))
                for i := 0; i < len(expectedDSID); i++ {
                        validateServersDeliveryServices(expectedDSID[i])(t, 
toclientlib.ReqInf{}, serverDeliveryServices.Response, tc.Alerts{}, nil)
 
diff --git a/traffic_ops/testing/api/v5/cachegroupsdeliveryservices_test.go 
b/traffic_ops/testing/api/v5/cachegroupsdeliveryservices_test.go
index 2ded463d34..919fdf3b7c 100644
--- a/traffic_ops/testing/api/v5/cachegroupsdeliveryservices_test.go
+++ b/traffic_ops/testing/api/v5/cachegroupsdeliveryservices_test.go
@@ -42,10 +42,8 @@ func TestCacheGroupsDeliveryServices(t *testing.T) {
                                        EndpointID:    GetCacheGroupId(t, 
"cachegroup3"),
                                        ClientSession: TOSession,
                                        RequestBody: []int{
-                                               GetDeliveryServiceId(t, 
"ds1")(),
-                                               GetDeliveryServiceId(t, 
"ds2")(),
-                                               GetDeliveryServiceId(t, 
"ds3")(),
                                                GetDeliveryServiceId(t, 
"ds3")(),
+                                               GetDeliveryServiceId(t, 
"ds4")(),
                                                GetDeliveryServiceId(t, 
"DS5")(),
                                        },
                                        Expectations: 
utils.CkRequest(utils.NoError(), utils.HasStatus(http.StatusOK), 
validateCGDSServerAssignments()),
diff --git a/traffic_ops/testing/api/v5/servers_id_deliveryservices_test.go 
b/traffic_ops/testing/api/v5/servers_id_deliveryservices_test.go
index 307dda3870..1ab7e5b840 100644
--- a/traffic_ops/testing/api/v5/servers_id_deliveryservices_test.go
+++ b/traffic_ops/testing/api/v5/servers_id_deliveryservices_test.go
@@ -192,7 +192,7 @@ func validateServersDeliveryServicesPost(serverID int, 
expectedDSID []int, expec
        return func(t *testing.T, _ toclientlib.ReqInf, resp interface{}, _ 
tc.Alerts, _ error) {
                serverDeliveryServices, _, err := 
TOSession.GetServerIDDeliveryServices(serverID, client.RequestOptions{})
                assert.RequireNoError(t, err, "Error getting Server Delivery 
Services: %v - alerts: %+v", err, serverDeliveryServices.Alerts)
-               assert.RequireEqual(t, expectedDSCount, 
len(serverDeliveryServices.Response), "Expected Two Delivery Service returned 
Got: %d", len(serverDeliveryServices.Response))
+               assert.RequireEqual(t, expectedDSCount, 
len(serverDeliveryServices.Response), "Expected %d Delivery Service returned 
Got: %d", expectedDSCount, len(serverDeliveryServices.Response))
                for i := 0; i < len(expectedDSID); i++ {
                        validateServersDeliveryServices(expectedDSID[i])(t, 
toclientlib.ReqInf{}, serverDeliveryServices.Response, tc.Alerts{}, nil)
 
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go 
b/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
index b0695cb7a6..f9b0e7d24a 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
@@ -945,7 +945,7 @@ func (dss *TODSSDeliveryService) Read(h http.Header, useIMS 
bool) ([]interface{}
        }
 
        where += `
-ds.id in (
+(ds.id in (
        SELECT deliveryService FROM deliveryservice_server WHERE server = 
:server
 ) OR ds.id in (
        SELECT id FROM deliveryservice
@@ -955,7 +955,18 @@ ds.id in (
                        SELECT name FROM cachegroup
                        WHERE id = (
                                SELECT cachegroup FROM server WHERE id = :server
-                       ))))
+                       ))))) 
+AND
+(( 
+(SELECT (t.name = 'ORG') FROM type t JOIN server s ON s.type = t.id WHERE s.id 
= :server) 
+OR 
+(SELECT COALESCE(ARRAY_AGG(ssc.server_capability), '{}') 
+FROM server_server_capability ssc 
+WHERE ssc."server" = :server) 
+@> 
+(
+SELECT COALESCE(ds.required_capabilities, '{}')
+)))
 `
 
        tenantIDs, err := tenant.GetUserTenantIDListTx(tx, user.TenantID)
diff --git a/traffic_ops/traffic_ops_golang/server/servers_assignment.go 
b/traffic_ops/traffic_ops_golang/server/servers_assignment.go
index 73d45328e8..da9c9e7c5f 100644
--- a/traffic_ops/traffic_ops_golang/server/servers_assignment.go
+++ b/traffic_ops/traffic_ops_golang/server/servers_assignment.go
@@ -305,7 +305,7 @@ func ValidateDSCapabilities(dsIDs []int, serverName string, 
tx *sql.Tx) (error,
        for id, caps := range dsCaps {
                for _, dsrc := range caps {
                        if !util.ContainsStr(sCaps, dsrc) {
-                               return errors.New(fmt.Sprintf("cache %s cannot 
assign delivery service %d without having the required delivery service 
capabilities: %v", serverName, id, dsCaps)), nil, http.StatusBadRequest
+                               return errors.New(fmt.Sprintf("cache %s cannot 
assign delivery service %d without having the required delivery service 
capabilities: %v", serverName, id, caps)), nil, http.StatusBadRequest
                        }
                }
        }
diff --git 
a/traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableAssignDSServersController.js
 
b/traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableAssignDSServersController.js
index ce6bbbf7b6..20ffd2401d 100644
--- 
a/traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableAssignDSServersController.js
+++ 
b/traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableAssignDSServersController.js
@@ -33,7 +33,7 @@ var TableAssignDSServersController = 
function(deliveryService, servers, assigned
                },
                {
                        headerName: "Cache Group",
-                       field: "cachegroup",
+                       field: "cacheGroup",
                },
                {
                        headerName: "Profile(s)",
diff --git a/traffic_portal/conf/configDev.js b/traffic_portal/conf/configDev.js
index 091a1da537..ee14d91581 100644
--- a/traffic_portal/conf/configDev.js
+++ b/traffic_portal/conf/configDev.js
@@ -23,18 +23,18 @@ module.exports = {
     useSSL: true, // set to true if you plan to use https (self-signed or 
trusted certs).
     // These ports are chosen to not collide with the default CDN-in-a-Box
     // exposed port numbers
-    port: 60444,
-    sslPort: 60443,
+    port: 8080,
+    sslPort: 9090,
     // if useSSL is true, generate ssl certs and provide the proper locations.
     ssl: {
-        key:    './localhost.key',
-        cert:   './localhost.crt',
-        ca:     [ './localhost.crt' ]
+        key:    '/etc/pki/tls/private/localhost.key',
+        cert:   '/etc/pki/tls/certs/localhost.crt',
+        ca:     [ '/etc/pki/tls/certs/ca-bundle.crt' ]
     },
     // set api 'base_url' to the traffic ops api url (all api calls made from 
the traffic portal will be proxied to the api base_url)
     // this is the default exposed port for the CDN-in-a-Box Traffic Ops 
service
     api: {
-        base_url: 'https://localhost:6443/api/'
+        base_url: 'https://localhost:8443/api/'
     },
     // default static files location (this is where the traffic portal html, 
css and javascript was installed. rpm installs these files at 
/opt/traffic_portal/public
     files: {
@@ -42,7 +42,7 @@ module.exports = {
     },
     // default log location (this is where traffic_portal logs are written)
     log: {
-        stream: './server/log/access.log'
+        stream: '/var/log/traffic_portal/access.log'
     },
     reject_unauthorized: 0 // 0 if using self-signed certs, 1 if trusted certs
 };
diff --git a/traffic_portal/test/integration/config.json 
b/traffic_portal/test/integration/config.json
index 2568e925bb..75d2ae61d5 100644
--- a/traffic_portal/test/integration/config.json
+++ b/traffic_portal/test/integration/config.json
@@ -29,11 +29,11 @@
     "stopSpecOnExpectationFailure": true
   },
   "params": {
-    "apiUrl": "https://localhost:443/api/5.0";,
-    "baseUrl": "https://localhost";,
+    "apiUrl": "https://localhost:8443/api/5.0";,
+    "baseUrl": "https://localhost:9090";,
     "login": {
       "username": "admin",
-      "password": "twelve12"
+      "password": "twelve"
     },
     "junitReporter": false
   }

Reply via email to