Skip to content

Pull conn status from oxp - #203

Open
congwang09 wants to merge 11 commits into
mainfrom
pull-conn-status-from-oxp
Open

Pull conn status from oxp#203
congwang09 wants to merge 11 commits into
mainfrom
pull-conn-status-from-oxp

Conversation

@congwang09

Copy link
Copy Markdown
Contributor

Periodically pull l2vpn status from OXP, and handle status change. If detected status change, send update to sdx-controller.

@coveralls

coveralls commented Feb 18, 2026

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 22147447197

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 80.399%

Totals Coverage Status
Change from base Build 21196301183: 0.0%
Covered Lines: 1210
Relevant Lines: 1505

💛 - Coveralls

@italovalcy italovalcy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @congwang09 very nice PR you sent! I left a few comments regarding the code structure.

Comment thread pyproject.toml
"asgiref >= 3.7.2",
"pymongo > 3.0",
"sdx-datamodel @ git+https://github.com/atlanticwave-sdx/datamodel@v3.2.1",
"sdx-datamodel @ git+https://github.com/atlanticwave-sdx/datamodel@v3.2.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Cong, can you please confirm this change? like using a older version?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Somehow datamodel's most recent tag is 3.2.0 (https://github.com/atlanticwave-sdx/datamodel/tags). I'll check with Yufeng to make sure tags are consistent.

Comment thread sdx_lc/jobs/pull_connection_changes.py Outdated
Comment thread sdx_lc/jobs/pull_connection_changes.py Outdated
Comment thread sdx_lc/jobs/pull_connection_changes.py Outdated
Comment thread sdx_lc/jobs/pull_connection_changes.py Outdated
Comment thread sdx_lc/jobs/pull_connection_changes.py
Comment thread env.template
OXP_TOPOLOGY_URL=http://192.168.201.205:8088/SDX-LC/1.0.0/topology
OXP_PULL_TOPOLOGY_INTERVAL=180
OXP_CONNECTION_URL=http://192.168.201.205:8088/SDX-LC/1.0.0/connection
OXP_LIST_CONNECTIONS_URL=http://192.168.201.205:8088/SDX-LC/1.0.0/connections

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

according to the L2VPN provisioning API, the same endpoint used for creating L2VPNs is used to list all L2VPNs. Thus, I believe we could have the same env var here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct me if I was wrong, the endpoint for creating l2vpn is "1.0.0/connection", while the one list all connections is "1.0.0/connections"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that was the earlier endpoint, but when we finished the spec for L2VPN provisioning API, we refactor the Kytos SDX Napp to support the new endpoints, which are both (for creating and listing) /l2vpn/1.0

see more: https://github.com/atlanticwave-sdx/sdx-end-to-end-tests/blob/e98cce8412ee820529187d0fbf478adbdcf63493/env/ampath-lc.env#L7

Comment thread sdx_lc/jobs/pull_connection_changes.py Outdated

for service_id, connection in connections_json.items():
# Fetch existing connection from DB
existing_connection = db_instance.get_value_by_key(service_id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cong, another doubt arrived while reviewing the SDX-COntroller side: can you please double check if we really want to maintain a database entry in the SDX-LC? It will make things a bit more complicated to make sure the L2VPNs are removed when removed, inserted, updated, etc. My question is: what is the actual advantage of keeping state on the SDX-LC (at least for l2vpns)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi Italo, the db in LC is to compare existing l2vpn's "status" with new "status" pulled from OXP, and only send specific l2vpn to SDX controller if status changes. If without database, we will need to periodically forward a long list of all l2vpn to SDX controller, and let SDX controller decide if status has changed. I think this would not be very efficient. I'm open to other options if you have better ideas.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, you are right Cong. From the efficiency perspective, this would save a few messages and bytes from being exchanged. However, when we designed the SDX-LC one of the ideas was not to maintain state or having much intelligence on it, so that we could have one central entity where the actual processing would happen (and then we can concentrate the decision making process and intelligence).

If we are to change this idea, that is fine for me. However, in that case, you have to delete the L2VPN from SDX-LC local database upon receiving a removal request from sdx-controller, right? can you please double check that?

elif msg_json.get("operation") == "delete":
evc_id = msg_json.get("evc_id")
try:
dest_url = urljoin(
str(OXP_CONNECTION_URL).rstrip("/") + "/", evc_id
)
self.logger.info(f"Sending DELETE request to URL: {dest_url}")
oxp_response = requests.delete(
dest_url,
json=connection,
auth=(OXP_USER, OXP_PASS),
)
except Exception as e:
self.logger.error(f"Error on DELETE {OXP_CONNECTION_URL}: {e}")
self.logger.info(
"Check your configuration and make sure OXP service is running."
)
self.logger.info(
f"Status from OXP: {oxp_response} - {oxp_response.text}"
)
self.send_conn_response_to_sdx_controller(
service_id, msg_json["operation"], oxp_response
)

Also, the pull L2VPN from OXP routine should check the local DB for missing L2VPNs and notify the Controller that missing L2VPN, right? Currently, this does not seems covered on the routine

Finally, for "alien" L2VPNs (i.e., the ones returned by OXP but not found on the local DB) we also should notify the SDX-Controller, right? currently, the routine is just ignoring them https://github.com/atlanticwave-sdx/sdx-lc/pull/203/changes#diff-92d2d9f91fcf0945f76b15e8823c1b9cc0b5106b66ea27f2c54d73caa69ff713R67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants