You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by sr...@apache.org on 2022/02/23 18:40:21 UTC

[trafficcontrol] branch revert_changes created (now c292ede)

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

srijeet0406 pushed a change to branch revert_changes
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.


      at c292ede  Revert "Geo limit countries can now be parsed as an array and a string (#6441)"

This branch includes the following new commits:

     new c292ede  Revert "Geo limit countries can now be parsed as an array and a string (#6441)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[trafficcontrol] 01/01: Revert "Geo limit countries can now be parsed as an array and a string (#6441)"

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

srijeet0406 pushed a commit to branch revert_changes
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit c292ede57d3e0b05d680b1961c9a8389d4d2cf72
Author: Srijeet Chatterjee <sr...@gmail.com>
AuthorDate: Wed Feb 23 11:38:41 2022 -0700

    Revert "Geo limit countries can now be parsed as an array and a string (#6441)"
    
    This reverts commit 79a1b24cb8f0c426dd2310cc9355115f09a4c4db.
---
 CHANGELOG.md                                       |  1 -
 cache-config/t3c-generate/cfgfile/cfgfile_test.go  |  2 +-
 docs/source/api/v4/deliveryservices.rst            |  6 +-
 docs/source/api/v4/deliveryservices_id.rst         |  4 +-
 docs/source/api/v4/deliveryservices_id_safe.rst    |  2 +-
 docs/source/api/v4/servers_id_deliveryservices.rst |  2 +-
 docs/source/overview/delivery_services.rst         |  2 +-
 lib/go-tc/deliveryservices.go                      | 50 +------------
 lib/go-tc/deliveryservices_test.go                 |  9 +--
 .../testing/api/v4/deliveryservices_test.go        | 62 ----------------
 .../crconfig/deliveryservice_test.go               | 82 ++--------------------
 .../deliveryservice/deliveryservices.go            | 48 +++----------
 traffic_ops/v4-client/server.go                    |  4 +-
 13 files changed, 28 insertions(+), 246 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f48ea5e..438ee3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -68,7 +68,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 ### Changed
 - Updated `t3c` to request less unnecessary deliveryservice-server assignment and invalidation jobs data via new query params supported by Traffic Ops
 - [#6179](https://github.com/apache/trafficcontrol/issues/6179) Updated the Traffic Ops rpm to include the `ToDnssecRefresh` binary and make the `trafops_dnssec_refresh` cron job use it
-- [#6382](https://github.com/apache/trafficcontrol/issues/6382) Accept Geo Limit Countries as strings and arrays.
 - Traffic Portal no longer uses `ruby compass` to compile sass and now uses `dart-sass`.
 - Changed Invalidation Jobs throughout (TO, TP, T3C, etc.) to account for the ability to do both REFRESH and REFETCH requests for resources.
 - Changed the `maxConnections` value on Traffic Router, to prevent the thundering herd problem (TR).
diff --git a/cache-config/t3c-generate/cfgfile/cfgfile_test.go b/cache-config/t3c-generate/cfgfile/cfgfile_test.go
index 60817f2..2864753 100644
--- a/cache-config/t3c-generate/cfgfile/cfgfile_test.go
+++ b/cache-config/t3c-generate/cfgfile/cfgfile_test.go
@@ -214,7 +214,7 @@ func randDS() *atscfg.DeliveryService {
 	ds.DSCP = randInt()
 	ds.EdgeHeaderRewrite = randStr()
 	ds.GeoLimit = randInt()
-	ds.GeoLimitCountries = nil
+	ds.GeoLimitCountries = randStr()
 	ds.GeoLimitRedirectURL = randStr()
 	ds.GeoProvider = randInt()
 	ds.GlobalMaxMBPS = randInt()
diff --git a/docs/source/api/v4/deliveryservices.rst b/docs/source/api/v4/deliveryservices.rst
index 9996bcf..c4bdaeb 100644
--- a/docs/source/api/v4/deliveryservices.rst
+++ b/docs/source/api/v4/deliveryservices.rst
@@ -104,7 +104,7 @@ Response Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         An array of strings defining the :ref:`ds-geo-limit-countries`
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
@@ -296,7 +296,7 @@ Request Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         A string containing a comma-separated list, or an array of strings defining the :ref:`ds-geo-limit-countries`\ [#geolimit]_
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`\ [#geolimit]_
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`\ [#geolimit]_
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
@@ -447,7 +447,7 @@ Response Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         An array of strings defining the :ref:`ds-geo-limit-countries`
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
diff --git a/docs/source/api/v4/deliveryservices_id.rst b/docs/source/api/v4/deliveryservices_id.rst
index 3ba01c0..8223317 100644
--- a/docs/source/api/v4/deliveryservices_id.rst
+++ b/docs/source/api/v4/deliveryservices_id.rst
@@ -52,7 +52,7 @@ Request Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         A string containing a comma-separated list, or an array of strings defining the :ref:`ds-geo-limit-countries`\ [#geolimit]_
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`\ [#geolimit]_
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`\ [#geolimit]_
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
@@ -204,7 +204,7 @@ Response Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         An array of strings defining the :ref:`ds-geo-limit-countries`
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
diff --git a/docs/source/api/v4/deliveryservices_id_safe.rst b/docs/source/api/v4/deliveryservices_id_safe.rst
index c6a529b..0501499 100644
--- a/docs/source/api/v4/deliveryservices_id_safe.rst
+++ b/docs/source/api/v4/deliveryservices_id_safe.rst
@@ -83,7 +83,7 @@ Response Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         An array of strings defining the :ref:`ds-geo-limit-countries`
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
diff --git a/docs/source/api/v4/servers_id_deliveryservices.rst b/docs/source/api/v4/servers_id_deliveryservices.rst
index a04d7fc..69112b9 100644
--- a/docs/source/api/v4/servers_id_deliveryservices.rst
+++ b/docs/source/api/v4/servers_id_deliveryservices.rst
@@ -91,7 +91,7 @@ Response Structure
 :firstHeaderRewrite:        A set of :ref:`ds-first-header-rw-rules`
 :fqPacingRate:              The :ref:`ds-fqpr`
 :geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         An array of strings defining the :ref:`ds-geo-limit-countries`
+:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`
 :geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`
 :geoProvider:               The :ref:`ds-geo-provider`
 :globalMaxMbps:             The :ref:`ds-global-max-mbps`
diff --git a/docs/source/overview/delivery_services.rst b/docs/source/overview/delivery_services.rst
index 389779a..4bc218f 100644
--- a/docs/source/overview/delivery_services.rst
+++ b/docs/source/overview/delivery_services.rst
@@ -277,7 +277,7 @@ Limits access to a Delivery Service by geographic location. The only practical d
 
 Geo Limit Countries
 -------------------
-When `Geo Limit`_ is being used with this Delivery Service (and is set to exactly ``2``), this is optionally a list of country codes to which access to content provided by the Delivery Service will be restricted. Normally, this is a comma-delimited string of said country codes, or an array of strings representing the country codes. When creating a Delivery Service with this field or modifying the Geo Limit Countries field on an existing Delivery Service, any amount of whitespace between  [...]
+When `Geo Limit`_ is being used with this Delivery Service (and is set to exactly ``2``), this is optionally a list of country codes to which access to content provided by the Delivery Service will be restricted. Normally, this is a comma-delimited string of said country codes. When creating a Delivery Service with this field or modifying the Geo Limit Countries field on an existing Delivery Service, any amount of whitespace between country codes is permissible, as it will be removed on  [...]
 
 .. table:: Aliases
 
diff --git a/lib/go-tc/deliveryservices.go b/lib/go-tc/deliveryservices.go
index 4462a27..6e729af 100644
--- a/lib/go-tc/deliveryservices.go
+++ b/lib/go-tc/deliveryservices.go
@@ -245,8 +245,7 @@ type DeliveryServiceV40 struct {
 
 	// TLSVersions is the list of explicitly supported TLS versions for cache
 	// servers serving the Delivery Service's content.
-	TLSVersions       []string              `json:"tlsVersions" db:"tls_versions"`
-	GeoLimitCountries GeoLimitCountriesType `json:"geoLimitCountries"`
+	TLSVersions []string `json:"tlsVersions" db:"tls_versions"`
 }
 
 // DeliveryServiceV4 is a Delivery Service as it appears in version 4 of the
@@ -578,40 +577,6 @@ type DeliveryServiceNullableV11 struct {
 	DeliveryServiceRemovedFieldsV11
 }
 
-// GeoLimitCountriesType is the type alias that is used to represent the GeoLimitCountries attribute of the DeliveryService struct.
-type GeoLimitCountriesType []string
-
-// UnmarshalJSON will unmarshal a byte slice into type GeoLimitCountriesType.
-func (g *GeoLimitCountriesType) UnmarshalJSON(data []byte) error {
-	var err error
-	var initial = make([]string, 0)
-	var initialStr string
-	if err = json.Unmarshal(data, &initial); err != nil {
-		if err = json.Unmarshal(data, &initialStr); err != nil {
-			return err
-		}
-		if strings.Contains(initialStr, ",") {
-			initial = strings.Split(initialStr, ",")
-		} else {
-			initial = append(initial, initialStr)
-		}
-	}
-
-	if initial == nil || len(initial) == 0 {
-		g = nil
-		return nil
-	}
-	*g = initial
-	return nil
-
-}
-
-// MarshalJSON will marshal a GeoLimitCountriesType into a byte slice.
-func (g GeoLimitCountriesType) MarshalJSON() ([]byte, error) {
-	arr := ([]string)(g)
-	return json.Marshal(arr)
-}
-
 // DeliveryServiceNullableFieldsV11 contains properties that Delivery Services
 // as they appeared in Traffic Ops API v1.1 had, AND were not removed by ANY
 // later API version.
@@ -848,10 +813,6 @@ func (ds *DeliveryServiceV4) RemoveLD1AndLD2() DeliveryServiceV4 {
 
 // DowngradeToV3 converts the 4.x DS to a 3.x DS.
 func (ds *DeliveryServiceV4) DowngradeToV3() DeliveryServiceNullableV30 {
-	nullableFields := ds.DeliveryServiceNullableFieldsV11
-	geoLimitCountries := ([]string)(ds.GeoLimitCountries)
-	geo := strings.Join(geoLimitCountries, ",")
-	nullableFields.GeoLimitCountries = &geo
 	return DeliveryServiceNullableV30{
 		DeliveryServiceV30: DeliveryServiceV30{
 			DeliveryServiceNullableV15: DeliveryServiceNullableV15{
@@ -859,7 +820,7 @@ func (ds *DeliveryServiceV4) DowngradeToV3() DeliveryServiceNullableV30 {
 					DeliveryServiceNullableV13: DeliveryServiceNullableV13{
 						DeliveryServiceNullableV12: DeliveryServiceNullableV12{
 							DeliveryServiceNullableV11: DeliveryServiceNullableV11{
-								DeliveryServiceNullableFieldsV11: nullableFields,
+								DeliveryServiceNullableFieldsV11: ds.DeliveryServiceNullableFieldsV11,
 							},
 						},
 						DeliveryServiceFieldsV13: ds.DeliveryServiceFieldsV13,
@@ -876,12 +837,6 @@ func (ds *DeliveryServiceV4) DowngradeToV3() DeliveryServiceNullableV30 {
 
 // UpgradeToV4 converts the 3.x DS to a 4.x DS.
 func (ds *DeliveryServiceNullableV30) UpgradeToV4() DeliveryServiceV4 {
-	var geo GeoLimitCountriesType
-	if ds.GeoLimitCountries != nil {
-		str := *ds.GeoLimitCountries
-		geo = make([]string, 0)
-		geo = strings.Split(str, ",")
-	}
 	return DeliveryServiceV4{
 		DeliveryServiceFieldsV31:         ds.DeliveryServiceFieldsV31,
 		DeliveryServiceFieldsV30:         ds.DeliveryServiceFieldsV30,
@@ -890,7 +845,6 @@ func (ds *DeliveryServiceNullableV30) UpgradeToV4() DeliveryServiceV4 {
 		DeliveryServiceFieldsV13:         ds.DeliveryServiceFieldsV13,
 		DeliveryServiceNullableFieldsV11: ds.DeliveryServiceNullableFieldsV11,
 		TLSVersions:                      nil,
-		GeoLimitCountries:                geo,
 	}
 }
 
diff --git a/lib/go-tc/deliveryservices_test.go b/lib/go-tc/deliveryservices_test.go
index 8491ed3..3ba0f6a 100644
--- a/lib/go-tc/deliveryservices_test.go
+++ b/lib/go-tc/deliveryservices_test.go
@@ -16,7 +16,6 @@ package tc
 
 import (
 	"fmt"
-	"strings"
 	"testing"
 )
 
@@ -413,9 +412,7 @@ func dsUpgradeAndDowngradeTestingPair() (DeliveryServiceNullableV30, DeliverySer
 	firstHeaderRewrite := "firstHeaderRewrite"
 	fqPacingRate := 1337
 	geoLimit := 2
-	geoLimitCountries := []string{"geo", "Limit", "Countries"}
-	geo := (GeoLimitCountriesType)(geoLimitCountries)
-	geoStr := strings.Join(geoLimitCountries, ",")
+	geoLimitCountries := "geo,Limit,Countries"
 	geoLimitRedirectURL := "wss://geoLimitRedirectURL"
 	geoProvider := 1
 	globalMaxMBPS := -72485
@@ -487,7 +484,7 @@ func dsUpgradeAndDowngradeTestingPair() (DeliveryServiceNullableV30, DeliverySer
 	newDS.FirstHeaderRewrite = &firstHeaderRewrite
 	newDS.FQPacingRate = &fqPacingRate
 	newDS.GeoLimit = &geoLimit
-	newDS.GeoLimitCountries = geo
+	newDS.GeoLimitCountries = &geoLimitCountries
 	newDS.GeoLimitRedirectURL = &geoLimitRedirectURL
 	newDS.GeoProvider = &geoProvider
 	newDS.GlobalMaxMBPS = &globalMaxMBPS
@@ -563,7 +560,7 @@ func dsUpgradeAndDowngradeTestingPair() (DeliveryServiceNullableV30, DeliverySer
 									EdgeHeaderRewrite:        &edgeHeaderRewrite,
 									ExampleURLs:              exampleURLs,
 									GeoLimit:                 &geoLimit,
-									GeoLimitCountries:        &geoStr,
+									GeoLimitCountries:        &geoLimitCountries,
 									GeoLimitRedirectURL:      &geoLimitRedirectURL,
 									GeoProvider:              &geoProvider,
 									GlobalMaxMBPS:            &globalMaxMBPS,
diff --git a/traffic_ops/testing/api/v4/deliveryservices_test.go b/traffic_ops/testing/api/v4/deliveryservices_test.go
index 25b21d9..6109921 100644
--- a/traffic_ops/testing/api/v4/deliveryservices_test.go
+++ b/traffic_ops/testing/api/v4/deliveryservices_test.go
@@ -54,7 +54,6 @@ func TestDeliveryServices(t *testing.T) {
 			t.Run("Create and retrieve SSL keys for a Delivery Service", DeliveryServiceSSLKeys)
 		}
 
-		t.Run("Create a Delivery Service with geo limit countries", CreateTestDeliveryServiceWithGeoLimitCountries)
 		t.Run("Create a Delivery Service with the removed Long Description 2 and 3 fields", CreateTestDeliveryServiceWithLongDescFields)
 		t.Run("Update a Delivery Service, setting its removed Long Description 2 and 3 fields", UpdateTestDeliveryServiceWithLongDescFields)
 		t.Run("Getting unmodified Delivery Services using the If-Modified-Since header", GetTestDeliveryServicesIMS)
@@ -99,67 +98,6 @@ func TestDeliveryServices(t *testing.T) {
 	})
 }
 
-func CreateTestDeliveryServiceWithGeoLimitCountries(t *testing.T) {
-
-	if len(testData.DeliveryServices) == 0 {
-		t.Fatalf("no deliveryservices to run the test on, quitting")
-	}
-
-	cdn := createBlankCDN("geoLimitCDN", t)
-	opts := client.NewRequestOptions()
-	opts.QueryParameters.Set("name", "HTTP")
-	types, _, err := TOSession.GetTypes(opts)
-	if err != nil {
-		t.Fatalf("unable to get Types: %v - alerts: %+v", err, types.Alerts)
-	}
-	if len(types.Response) < 1 {
-		t.Fatal("expected at least one type")
-	}
-	customDS := getCustomDS(cdn.ID, types.Response[0].ID, "geo-limit-countries-test-ds-name", "edge", "https://test-geo-limit.com", "geo-limit-countries-test-ds-xml-id")
-	customDS.Protocol = util.IntPtr(0)
-	customDS.GeoLimit = util.IntPtr(2)
-	//geoLimitCountries := []string{"US   ", "CA"}
-	customDS.GeoLimitCountries = []string{"US   ", "CA"}
-
-	resp, _, err := TOSession.CreateDeliveryService(customDS, client.RequestOptions{})
-	if err != nil {
-		t.Errorf("expected no error while creating a new ds, but got %v", err)
-	}
-	if len(resp.Response) != 1 {
-		t.Fatalf("expected 1 response in return of a create DS request, but got %d", len(resp.Response))
-	}
-	if resp.Response[0].GeoLimitCountries == nil {
-		t.Fatalf("got nothing in geo limit countries")
-	}
-	arr := ([]string)(resp.Response[0].GeoLimitCountries)
-	if len(arr) != 2 || arr[0] != "US" || arr[1] != "CA" {
-		t.Errorf("expected geo limit countries: US,CA; actual: %s", arr)
-	}
-	opts = client.NewRequestOptions()
-	opts.QueryParameters.Set("xmlId", *customDS.XMLID)
-	deliveryServices, _, err := TOSession.GetDeliveryServices(opts)
-	if err != nil {
-		t.Fatalf("couldn't get ds: %v", err)
-	}
-	if len(deliveryServices.Response) != 1 {
-		t.Fatal("couldn't get exactly one ds in the response, quitting")
-	}
-	dsID := deliveryServices.Response[0].ID
-	if dsID == nil {
-		t.Fatalf("got a delivery service with no ID")
-	}
-	customDS.GeoLimitCountries = []string{"US   ", "CA", "12"}
-	_, _, err = TOSession.UpdateDeliveryService(*dsID, customDS, client.RequestOptions{})
-	if err == nil {
-		t.Error("expected an error while updating geo limit countries of a ds with an invalid country code, but got nothing")
-	}
-
-	_, _, err = TOSession.DeleteDeliveryService(*dsID, client.NewRequestOptions())
-	if err != nil {
-		t.Errorf("expected no error while deleting ds, but got %v", err)
-	}
-}
-
 func CUDDeliveryServiceWithLocks(t *testing.T) {
 	// Create a new user with operations level privileges
 	user1 := tc.UserV4{
diff --git a/traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go b/traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go
index 5ff78ee..3904834 100644
--- a/traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go
+++ b/traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go
@@ -123,11 +123,7 @@ func ExpectedMakeDSes() map[string]tc.CRConfigDeliveryService {
 	}
 }
 
-func MockMakeDSes(mock sqlmock.Sqlmock, expected map[string]tc.CRConfigDeliveryService, cdn string, geoEnabled string) {
-	geoLimit := 0
-	if len(geoEnabled) != 0 {
-		geoLimit = 2
-	}
+func MockMakeDSes(mock sqlmock.Sqlmock, expected map[string]tc.CRConfigDeliveryService, cdn string) {
 	rows := sqlmock.NewRows([]string{
 		"anonymous_blocking_enabled",
 		"consistent_hash_regex",
@@ -177,8 +173,8 @@ func MockMakeDSes(mock sqlmock.Sqlmock, expected map[string]tc.CRConfigDeliveryS
 			*ds.TTL,
 			*ds.EcsEnabled,
 			false,
-			geoLimit,
-			geoEnabled,
+			0,
+			"",
 			"",
 			0,
 			*ds.BypassDestination["HTTP"].FQDN,
@@ -199,76 +195,6 @@ func MockMakeDSes(mock sqlmock.Sqlmock, expected map[string]tc.CRConfigDeliveryS
 	mock.ExpectQuery("select").WithArgs(cdn).WillReturnRows(rows)
 }
 
-func TestMakeDSesGeoLimit(t *testing.T) {
-	db, mock, err := sqlmock.New()
-	if err != nil {
-		t.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
-	}
-	defer db.Close()
-
-	cdn := "mycdn"
-	domain := "mycdn.invalid"
-
-	expected := ExpectedMakeDSes()
-	delete(expected, "ds2")
-	expectedDS := expected["ds1"]
-	geoEnabled := make([]tc.CRConfigGeoEnabled, 0)
-	geoEnabledCountry := tc.CRConfigGeoEnabled{CountryCode: "US"}
-	geoEnabled = append(geoEnabled, geoEnabledCountry)
-	geoEnabledCountry = tc.CRConfigGeoEnabled{CountryCode: "CA"}
-	geoEnabled = append(geoEnabled, geoEnabledCountry)
-	expectedDS.GeoEnabled = geoEnabled
-	expected["ds1"] = expectedDS
-
-	expectedParams := ExpectedGetServerProfileParams(expected)
-	expectedDSParams, err := getDSParams(expectedParams)
-	if err != nil {
-		t.Fatalf("getDSParams error expected: nil, actual: %v", err)
-	}
-	expectedMatchsets, expectedDomains := ExpectedGetDSRegexesDomains(expectedDSParams)
-	expectedStaticDNSEntries := ExpectedGetStaticDNSEntries(expected)
-
-	mock.ExpectBegin()
-	MockGetServerProfileParams(mock, expectedParams, cdn)
-	MockGetDSRegexesDomains(mock, expectedMatchsets, expectedDomains, cdn)
-	MockGetStaticDNSEntries(mock, expectedStaticDNSEntries, cdn)
-	MockMakeDSes(mock, expected, cdn, "US,CA")
-	mock.ExpectCommit()
-
-	dbCtx, cancelTx := context.WithTimeout(context.TODO(), 10*time.Second)
-	defer cancelTx()
-	tx, err := db.BeginTx(dbCtx, nil)
-	if err != nil {
-		t.Fatalf("creating transaction: %v", err)
-	}
-	defer tx.Commit()
-
-	actual, err := makeDSes(cdn, domain, tx)
-	if err != nil {
-		t.Fatalf("makeDSes expected: nil error, actual: %v", err)
-	}
-
-	if len(actual) != len(expected) {
-		t.Fatalf("makeDses len expected: %v, actual: %v", len(expected), len(actual))
-	}
-
-	for dsName, ds := range expected {
-		actualDS, ok := actual[dsName]
-		if !ok {
-			t.Errorf("makeDSes expected: %v, actual: missing", dsName)
-			continue
-		}
-		if len(ds.GeoEnabled) != len(actualDS.GeoEnabled) {
-			t.Fatalf("expected DS Geoenabled length %d != actual DS Geoenabled length %d", len(ds.GeoEnabled), len(actualDS.GeoEnabled))
-		}
-		for i, countryCode := range ds.GeoEnabled {
-			if countryCode != actualDS.GeoEnabled[i] {
-				t.Errorf("mismatch in geo enabled countries of expected DS and actual DS, expected: %s, actual: %s", countryCode, actualDS.GeoEnabled[i])
-			}
-		}
-	}
-}
-
 func TestMakeDSes(t *testing.T) {
 	db, mock, err := sqlmock.New()
 	if err != nil {
@@ -292,7 +218,7 @@ func TestMakeDSes(t *testing.T) {
 	MockGetServerProfileParams(mock, expectedParams, cdn)
 	MockGetDSRegexesDomains(mock, expectedMatchsets, expectedDomains, cdn)
 	MockGetStaticDNSEntries(mock, expectedStaticDNSEntries, cdn)
-	MockMakeDSes(mock, expected, cdn, "")
+	MockMakeDSes(mock, expected, cdn)
 	mock.ExpectCommit()
 
 	dbCtx, cancelTx := context.WithTimeout(context.TODO(), 10*time.Second)
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
index 56500c8..abbfb7d 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
@@ -211,6 +211,7 @@ func CreateV40(w http.ResponseWriter, r *http.Request) {
 		api.HandleErr(w, r, inf.Tx.Tx, http.StatusBadRequest, errors.New("decoding: "+err.Error()), nil)
 		return
 	}
+
 	res, status, userErr, sysErr := createV40(w, r, inf, ds, true)
 	if userErr != nil || sysErr != nil {
 		api.HandleErr(w, r, inf.Tx.Tx, status, userErr, sysErr)
@@ -302,7 +303,6 @@ func createV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 t
 	tx := inf.Tx.Tx
 	ds := tc.DeliveryServiceV4(dsV40)
 	err := Validate(tx, &ds)
-	var geoLimitCountries string
 	if err != nil {
 		return nil, http.StatusBadRequest, errors.New("invalid request: " + err.Error()), nil
 	}
@@ -327,8 +327,6 @@ func createV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 t
 	if userErr != nil || sysErr != nil {
 		return nil, errCode, userErr, sysErr
 	}
-	geo := ([]string)(ds.GeoLimitCountries)
-	geoLimitCountries = strings.Join(geo, ",")
 	var resultRows *sql.Rows
 	if omitExtraLongDescFields {
 		if ds.LongDesc1 != nil || ds.LongDesc2 != nil {
@@ -351,7 +349,7 @@ func createV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 t
 			&ds.EdgeHeaderRewrite,
 			&ds.GeoLimitRedirectURL,
 			&ds.GeoLimit,
-			&geoLimitCountries,
+			&ds.GeoLimitCountries,
 			&ds.GeoProvider,
 			&ds.GlobalMaxMBPS,
 			&ds.GlobalMaxTPS,
@@ -411,7 +409,7 @@ func createV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 t
 			&ds.EdgeHeaderRewrite,
 			&ds.GeoLimitRedirectURL,
 			&ds.GeoLimit,
-			&geoLimitCountries,
+			&ds.GeoLimitCountries,
 			&ds.GeoProvider,
 			&ds.GlobalMaxMBPS,
 			&ds.GlobalMaxTPS,
@@ -595,6 +593,7 @@ func (ds *TODeliveryService) Read(h http.Header, useIMS bool) ([]interface{}, er
 
 	returnable := []interface{}{}
 	dses, userErr, sysErr, errCode, maxTime := readGetDeliveryServices(h, ds.APIInfo().Params, ds.APIInfo().Tx, ds.APIInfo().User, useIMS)
+
 	if sysErr != nil {
 		sysErr = errors.New("reading dses: " + sysErr.Error())
 		errCode = http.StatusInternalServerError
@@ -914,11 +913,6 @@ func updateV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 *
 		}
 	}
 
-	var geoLimitCountries string
-	if ds.GeoLimitCountries != nil {
-		geo := ([]string)(ds.GeoLimitCountries)
-		geoLimitCountries = strings.Join(geo, ",")
-	}
 	var resultRows *sql.Rows
 	if omitExtraLongDescFields {
 		if ds.LongDesc1 != nil || ds.LongDesc2 != nil {
@@ -939,7 +933,7 @@ func updateV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 *
 			&ds.EdgeHeaderRewrite,
 			&ds.GeoLimitRedirectURL,
 			&ds.GeoLimit,
-			&geoLimitCountries,
+			&ds.GeoLimitCountries,
 			&ds.GeoProvider,
 			&ds.GlobalMaxMBPS,
 			&ds.GlobalMaxTPS,
@@ -999,7 +993,7 @@ func updateV40(w http.ResponseWriter, r *http.Request, inf *api.APIInfo, dsV40 *
 			&ds.EdgeHeaderRewrite,
 			&ds.GeoLimitRedirectURL,
 			&ds.GeoLimit,
-			&geoLimitCountries,
+			&ds.GeoLimitCountries,
 			&ds.GeoProvider,
 			&ds.GlobalMaxMBPS,
 			&ds.GlobalMaxTPS,
@@ -1378,9 +1372,6 @@ func Validate(tx *sql.Tx, ds *tc.DeliveryServiceV4) error {
 			},
 		)),
 	})
-	if err := validateGeoLimitCountries(ds); err != nil {
-		errs = append(errs, err)
-	}
 	if err := validateTopologyFields(ds); err != nil {
 		errs = append(errs, err)
 	}
@@ -1393,20 +1384,6 @@ func Validate(tx *sql.Tx, ds *tc.DeliveryServiceV4) error {
 	return util.JoinErrs(errs)
 }
 
-func validateGeoLimitCountries(ds *tc.DeliveryServiceV4) error {
-	var IsLetter = regexp.MustCompile(`^[A-Z]+$`).MatchString
-	if ds.GeoLimitCountries == nil {
-		return nil
-	}
-	countryCodes := ([]string)(ds.GeoLimitCountries)
-	for _, cc := range countryCodes {
-		if cc != "" && !IsLetter(cc) {
-			return fmt.Errorf("country codes can only contain alphabets")
-		}
-	}
-	return nil
-}
-
 func validateTopologyFields(ds *tc.DeliveryServiceV4) error {
 	if ds.Topology != nil && (ds.EdgeHeaderRewrite != nil || ds.MidHeaderRewrite != nil) {
 		return errors.New("cannot set edgeHeaderRewrite or midHeaderRewrite while a Topology is assigned. Use firstHeaderRewrite, innerHeaderRewrite, and/or lastHeaderRewrite instead")
@@ -1675,7 +1652,6 @@ func GetDeliveryServices(query string, queryValues map[string]interface{}, tx *s
 	// ensure json generated from this slice won't come out as `null` if empty
 	dsQueryParams := []string{}
 
-	geoLimitCountries := util.StrPtr("")
 	for rows.Next() {
 		ds := tc.DeliveryServiceV4{}
 		cdnDomain := ""
@@ -1698,7 +1674,7 @@ func GetDeliveryServices(query string, queryValues map[string]interface{}, tx *s
 			&ds.FirstHeaderRewrite,
 			&ds.GeoLimitRedirectURL,
 			&ds.GeoLimit,
-			&geoLimitCountries,
+			&ds.GeoLimitCountries,
 			&ds.GeoProvider,
 			&ds.GlobalMaxMBPS,
 			&ds.GlobalMaxTPS,
@@ -1754,10 +1730,6 @@ func GetDeliveryServices(query string, queryValues map[string]interface{}, tx *s
 			return nil, nil, fmt.Errorf("getting delivery services: %v", err), http.StatusInternalServerError
 		}
 
-		if geoLimitCountries != nil && *geoLimitCountries != "" {
-			geo := strings.Split(*geoLimitCountries, ",")
-			ds.GeoLimitCountries = geo
-		}
 		ds.ConsistentHashQueryParams = []string{}
 		if len(dsQueryParams) >= 0 {
 			// ensure unique and in consistent order
@@ -2166,11 +2138,7 @@ func setNilIfEmpty(ptrs ...**string) {
 
 func sanitize(ds *tc.DeliveryServiceV4) {
 	if ds.GeoLimitCountries != nil {
-		geo := ([]string)(ds.GeoLimitCountries)
-		for i, _ := range geo {
-			geo[i] = strings.ToUpper(strings.Replace(geo[i], " ", "", -1))
-		}
-		ds.GeoLimitCountries = geo
+		*ds.GeoLimitCountries = strings.ToUpper(strings.Replace(*ds.GeoLimitCountries, " ", "", -1))
 	}
 	if ds.ProfileID != nil && *ds.ProfileID == -1 {
 		ds.ProfileID = nil
diff --git a/traffic_ops/v4-client/server.go b/traffic_ops/v4-client/server.go
index 272f15c..2c3299e 100644
--- a/traffic_ops/v4-client/server.go
+++ b/traffic_ops/v4-client/server.go
@@ -176,9 +176,9 @@ func (to *Session) AssignDeliveryServiceIDsToServerID(server int, dsIDs []int, r
 
 // GetServerIDDeliveryServices returns all of the Delivery Services assigned to the server identified
 // by the integral, unique identifier 'server'.
-func (to *Session) GetServerIDDeliveryServices(server int, opts RequestOptions) (tc.DeliveryServicesResponseV4, toclientlib.ReqInf, error) {
+func (to *Session) GetServerIDDeliveryServices(server int, opts RequestOptions) (tc.DeliveryServicesNullableResponse, toclientlib.ReqInf, error) {
 	endpoint := fmt.Sprintf(apiServerDeliveryServices, server)
-	var data tc.DeliveryServicesResponseV4
+	var data tc.DeliveryServicesNullableResponse
 	reqInf, err := to.get(endpoint, opts, &data)
 	return data, reqInf, err
 }