Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

[TO] Added a new route and logic for assigning multiple server capabilities to a server#6996

Merged
ocket8888 merged 19 commits intoapache:masterfrom
rimashah25:feature/multiple_server_capabilities
Aug 9, 2022
Merged

[TO] Added a new route and logic for assigning multiple server capabilities to a server#6996
ocket8888 merged 19 commits intoapache:masterfrom
rimashah25:feature/multiple_server_capabilities

Conversation

@rimashah25
Copy link
Copy Markdown
Contributor

@rimashah25 rimashah25 commented Aug 1, 2022

Closes: #7088


Which Traffic Control components are affected by this PR?

  • Documentation
  • Traffic Ops

What is the best way to verify this PR?

Using curl cmds test the new route with a list of server capabilities

  • Success Assignment

curl -X PUT -k -H "Accept: application/json" --cookie "mojolicious=" --data @msc.json https://localhost:port/api/4.1/multiple_server_capabilities/106

{
	"alerts": [{
		"text": "Multiple Server Capabilities assigned to a server:106",
		"level": "success"
	}],
	"response": {
		"serverId": 106,
		"serverCapability": ["test", "disk"]
	}
}
  • Trying to assign server capabilities for an unknown server

curl -X PUT -k -H "Accept: application/json" --cookie "mojolicious==" --data @msc.json https://localhost:port/api/4.1/multiple_server_capabilities/3

{
	"alerts": [{
		"text": "server 3 does not exist",
		"level": "error"
	}]
}
  • Incorrect route

curl -X PUT -k -H "Accept: application/json" --cookie "mojolicious==" --data @msc.json https://localhost:port/api/4.0/multiple_server_capabilities/3

{
	"alerts": [{
		"text": "The requested path '/api/4.0/multiple_server_capabilities/3' does not exist.",
		"level": "error"
	}]
}

PR submission checklist

@rimashah25 rimashah25 marked this pull request as ready for review August 1, 2022 23:42
@ocket8888 ocket8888 self-assigned this Aug 2, 2022
@ocket8888 ocket8888 added new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops low impact affects only a small portion of a CDN, and cannot itself break one labels Aug 2, 2022
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider just adding the ability to submit an array of capabilities to server_server_capabilities instead of making an endpoint? If so, why did you decide against it?

Comment thread lib/go-tc/server_server_capability.go
Comment thread lib/go-tc/server_server_capability.go Outdated
Comment thread traffic_ops/traffic_ops_golang/routing/routes.go Outdated
Comment thread traffic_ops/traffic_ops_golang/server/servers_server_capability.go Outdated
Comment thread traffic_ops/traffic_ops_golang/server/servers_server_capability.go Outdated
Comment thread traffic_ops/v4-client/server_server_capabilities.go Outdated
Comment thread traffic_ops/v4-client/server_server_capabilities.go Outdated
Comment thread docs/source/api/v4/multiple_server_capabilities.rst
Comment thread docs/source/api/v4/multiple_server_capabilities.rst Outdated
Comment thread docs/source/api/v4/multiple_server_capabilities.rst Outdated
@rimashah25 rimashah25 requested a review from ocket8888 August 3, 2022 18:44
Comment thread docs/source/api/v4/multiple_server_capabilities.rst Outdated
Comment thread docs/source/api/v4/multiple_server_capabilities.rst Outdated
Comment thread traffic_ops/traffic_ops_golang/server/servers_server_capability.go Outdated
Comment thread traffic_ops/traffic_ops_golang/server/servers_server_capability.go Outdated
Comment thread lib/go-tc/server_server_capability.go Outdated
@rimashah25 rimashah25 requested a review from ocket8888 August 4, 2022 21:50
Comment thread traffic_ops/traffic_ops_golang/server/servers_server_capability.go Outdated
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint seems to work well from testing. Just a couple of minor comments.

Comment thread traffic_ops/traffic_ops_golang/server/servers_server_capability.go Outdated
Comment thread docs/source/api/v4/multiple_server_capabilities.rst Outdated
@ocket8888 ocket8888 merged commit 073e431 into apache:master Aug 9, 2022
@rimashah25 rimashah25 deleted the feature/multiple_server_capabilities branch August 9, 2022 18:55
@rimashah25 rimashah25 changed the title Added a new route and logic for assigning multiple server capabilities to a server [TO] Added a new route and logic for assigning multiple server capabilities to a server Aug 12, 2022
zrhoffman pushed a commit to zrhoffman/trafficcontrol that referenced this pull request Oct 2, 2022
…s to a server (apache#6996)

* Added a new route and logic for assigning multiple server capabilities to a server.

* Added tests for assigning multiple server capabilities to a server.

* Updated CHANGELOG.md

* Updated test based on latest table driven model

* Added documentation for new route.

* Fixed spacing.

* Fixed spacing.

* Updated based on review comments.

* Updated based on review comments-1.

* Added both API versions to allow client flexibility.

* Updated order of API versions.

* Removed `id` parameter.

* Updated based on another set of review comments.

* Updated test based on route change

* updated format.

* Revert "updated format."

This reverts commit 8181b51.

* removed format and updated docs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

low impact affects only a small portion of a CDN, and cannot itself break one new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to assign multiple server capabilities to a server

2 participants