jehunte opened a new pull request #4518: Add service category feature to TO and TP URL: https://github.com/apache/trafficcontrol/pull/4518 <!-- ************ STOP!! ************ If this Pull Request is intended to fix a security vulnerability, DO NOT submit it! Instead, contact the Apache Software Foundation Security Team at secur...@trafficcontrol.apache.org and follow the guidelines at https://www.apache.org/security/ regarding vulnerability disclosure. --> ## What does this PR (Pull Request) do? <!-- Explain the changes you made here. If this fixes an Issue, identify it by replacing the text in the checkbox item with the Issue number e.g. - [x] This PR enables the user to associate a delivery service with a specific service category. The user can create, add, update, delete categories as necessary and the value will be used in combination with the xmlid to set the header "X-CDN-SVC" Be sure you check the box properly, see the "The following criteria are ALL met by this PR" section for details. --> - [x] This PR is not related to any Issue <!-- You can check for an issue here: https://github.com/apache/trafficcontrol/issues --> ## Which Traffic Control components are affected by this PR? - Documentation - Traffic Control Client Go - Traffic Ops - Traffic Ops ORT - atstccfg - Traffic Portal ## What is the best way to verify this PR? 1. Validate database changes - New table service category with columns (id, name, last_updated) - service_category column added to delivery service table 2. Verify in TP that you can: - create a new delivery service with a service category - Add, update, delete, get service categories 3. Run the ORT script and verify that the header is being set properly X-CDN-SVC "{xmlid}|{service-category}" ## The following criteria are ALL met by this PR - [x] This PR includes tests OR I have explained why tests are unnecessary - [x] This PR includes documentation OR I have explained why documentation is unnecessary - [x] This PR includes an update to CHANGELOG.md OR such an update is not necessary - [x] This PR includes any and all required license headers - [x] This PR ensures that database migration sequence is correct OR this PR does not include a database migration - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details) ## Additional Information These SQL queries will get any existing service categories from the edge header rewrite and populate the column/table INSERT INTO service_category(name) SELECT DISTINCT substring(edge_header_rewrite FROM '(?<=\|)(.*?)(?=\")') FROM deliveryservice WHERE substring(edge_header_rewrite FROM '(?<=\|)(.*?)(?=\")') IS NOT NULL; UPDATE deliveryservice SET service_category = service_category.id FROM service_category WHERE substring(edge_header_rewrite FROM '(?<=\|)(.*?)(?=\")') = service_category.name; <img width="1675" alt="Screen Shot 2020-03-18 at 9 41 30 AM" src="https://user-images.githubusercontent.com/61031690/76981697-93465d00-6900-11ea-9d4b-68ba8809356a.png"> <img width="222" alt="Screen Shot 2020-03-18 at 9 41 41 AM" src="https://user-images.githubusercontent.com/61031690/76981730-9a6d6b00-6900-11ea-97e5-87d24227e7f2.png"> <img width="1667" alt="Screen Shot 2020-03-18 at 9 41 51 AM" src="https://user-images.githubusercontent.com/61031690/76981752-9f321f00-6900-11ea-815f-4ad1b0cc0260.png"> <img width="1674" alt="Screen Shot 2020-03-18 at 9 42 01 AM" src="https://user-images.githubusercontent.com/61031690/76981777-a48f6980-6900-11ea-8b82-d24403935dec.png"> <img width="1679" alt="Screen Shot 2020-03-18 at 9 42 12 AM" src="https://user-images.githubusercontent.com/61031690/76981787-a78a5a00-6900-11ea-855e-26948c2819a2.png"> <img width="1416" alt="Screen Shot 2020-03-18 at 9 42 58 AM" src="https://user-images.githubusercontent.com/61031690/76981803-ab1de100-6900-11ea-9e96-03a9a34ee744.png"> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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. -->
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services