Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

[Node Mgr] Node Manager Interface for NCM Registration #598

Merged
merged 5 commits into from
Apr 23, 2021

Conversation

pkommoju
Copy link
Contributor

@pkommoju pkommoju commented Apr 15, 2021

Node Manager Interface for NCM Registration

IMPORTANT NOTE

  • This is yet another breaking change. This commit introduces named
    versions of NodeInfo cache in NMM, DPM and NCM. Previously, the three
    were physically the same cache.

If any code/test assumes the existence of certain node in these caches
before this change, they will not find those entries since this change.
creates new caches.

Regular change notes:

  • Node creation will continue to work if nodeinfo has no ncmid to be backward
    compatible. Delete, update file upload, bulk add all are 100% backward
    compatible if ndmid is missing.

  • If ncmid is present, it must resolve to a registered NCM or an error will
    be raised.

  • Update integration test script (scripts/test/nmm-ncm-test.sh) with NCM

  • id/uri. UPDATE is also validated. Added node creation with no NCMID.

  • Fix update/delete getting called through wrong methods in DPM/NCM rest
    client code. Using rest template exchange method with correct HTTP
    headers is required in those sites.

IMPORTANT NOTE:
This is a breaking change in the following way:
create/update node will fail if NodeInfo doesn't contain a valid
NCM uri.
This means, 1) An instance of NCM must be running, 2) The NCM
should be registered with NMM first. NCM Registration should
contain the valid http end-point (like, http://localhost:9014)
and an ID. NodeInfo should contain this NCM ID.

delete node will work only if an NCM is up and running at
http://localhost:9014. Currently this is an issue, it is defered
to next commit since it requires solving a rather tricky problem but
it will be fixed as soon as possible.

The same conditions apply to bulk/file upload methods to create,
update and delete nodes through NMM.

Fix known issues in previous commit
- Node creation returns error if the ncm_id has not been registered.
- NMM query by ncm_id is working.
- NMM is using NCM URI to talk to NCM, except for DELETE (pending issue)
- No Unit tests yet, only swagger UI has been used to validate the code.
  Unit tests don't seem to test the real API, the integration test
  script for testing NMM to NCM flow will be extended.
@pkommoju pkommoju requested review from cj-chung and xieus April 15, 2021 02:19
@codecov-io
Copy link

Codecov Report

Merging #598 (a35b630) into master (5bd9709) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #598      +/-   ##
============================================
- Coverage     32.64%   32.64%   -0.01%     
+ Complexity     1239     1238       -1     
============================================
  Files           521      521              
  Lines         13079    13070       -9     
  Branches       1603     1598       -5     
============================================
- Hits           4270     4267       -3     
+ Misses         8230     8223       -7     
- Partials        579      580       +1     
Impacted Files Coverage Δ Complexity Δ
...i/alcor/nodemanager/controller/NodeController.java 29.68% <0.00%> (ø) 10.00 <0.00> (ø)
...nodemanager/service/implement/NodeServiceImpl.java 0.88% <0.00%> (+0.03%) 2.00 <0.00> (ø)
...alcor/portmanager/util/RestParameterValidator.java 43.07% <0.00%> (-3.08%) 13.00% <0.00%> (-1.00%)
...alcor/elasticipmanager/dao/ElasticIpAllocator.java 63.53% <0.00%> (-0.28%) 48.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bd9709...a35b630. Read the comment docs.

@xieus xieus added the bug Something isn't working label Apr 15, 2021
@xieus xieus added this to the Version 0.12.2021.04.30 milestone Apr 15, 2021
@xieus
Copy link
Contributor

xieus commented Apr 15, 2021

IMPORTANT NOTE:
This is a breaking change in the following way:
create/update node will fail if NodeInfo doesn't contain a valid
NCM uri.
This means, 1) An instance of NCM must be running, 2) The NCM
should be registered with NMM first. NCM Registration should
contain the valid http end-point (like, http://localhost:9014)
and an ID. NodeInfo should contain this NCM ID.

Good to make a breaking change explicit. Do we support node registration with an empty or null NCM id?

No. It will fail. How about introducing a concept of "default NCM" to support node lifetime management
withou ncmid and ncmuri? NMM will use the default values if ncmid is empty/null but if ncmid is present
it must resolve to a valid NCM (uri).

IMPORTANT NOTE:
- This is yet another breaking change. This commit introduces named
versions of NodeInfo cache in NMM, DPM and NCM. Previously, the three
were physically the same cache.

If any code/test assumes the existence of certain node in these caches
before this change, they will not find those entries since this change.
creates new caches.

- This commit also introduces an implicit assumption that bulk adding of
nodes can only be done to one NCM at a time. Even if each nodeinfo has a
distinct NCM id, NMM will pick the NCM Id from the first nodeinfo and
send the whole batch to that NCM.

- Node creation via file upload was meant to be an admin task and was
  not designed to dispatch those nodes to DPM and NCM. This commit
  does not change this old behavior.

Regular change notes:

- Node creation will continue to work if nodeinfo has no ncmid and no
  NCM is running, or NCM is running but has no NCM is registered with NMM.

- Update integration test script (scripts/test/nmm-ncm-test.sh) with NCM
  id/uri. UPDATE is also validated.

- Fix update/delete getting called through wrong methods in DPM/NCM rest
  client code. Using rest template exchange method with correct HTTP
  headers is required in those sites.
@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2021

Codecov Report

Merging #598 (a6a4670) into master (0a58676) will increase coverage by 0.03%.
The diff coverage is 7.14%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #598      +/-   ##
============================================
+ Coverage     32.67%   32.71%   +0.03%     
- Complexity     1242     1247       +5     
============================================
  Files           522      522              
  Lines         13096    13093       -3     
  Branches       1610     1606       -4     
============================================
+ Hits           4279     4283       +4     
+ Misses         8236     8232       -4     
+ Partials        581      578       -3     
Impacted Files Coverage Δ Complexity Δ
...i/alcor/netwconfigmanager/cache/NodeInfoCache.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...i/alcor/nodemanager/controller/NodeController.java 29.68% <0.00%> (ø) 10.00 <0.00> (ø)
...nodemanager/request/BulkCreateNodeInfoRequest.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
...cor/nodemanager/request/DeleteNodeInfoRequest.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...nodemanager/service/implement/NodeServiceImpl.java 0.86% <0.00%> (+0.01%) 2.00 <0.00> (ø)
...i/alcor/nodemanager/utils/NodeManagerConstant.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
...rewei/alcor/nodemanager/dao/NcmInfoRepository.java 13.95% <50.00%> (-0.34%) 3.00 <0.00> (ø)
...uturewei/alcor/nodemanager/dao/NodeRepository.java 13.33% <100.00%> (ø) 3.00 <0.00> (ø)
...rewei/alcor/portmanager/processor/PortContext.java 71.62% <0.00%> (+2.70%) 33.00% <0.00%> (+2.00%)
...i/alcor/portmanager/processor/RouterProcessor.java 85.29% <0.00%> (+5.88%) 10.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a58676...a6a4670. Read the comment docs.

Copy link
Contributor

@xieus xieus left a comment

Choose a reason for hiding this comment

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

LGTM.

@xieus
Copy link
Contributor

xieus commented Apr 21, 2021

@pkommoju Please create a tracking issue for every outstanding item.
Created two issues to address two enhancements/issues (600, 601) noted in the commit message.

__IMPORTANT NOTE__
* This is yet another breaking change. This commit introduces named
versions of NodeInfo cache in NMM, DPM and NCM. Previously, the three
were physically the same cache.

If any code/test assumes the existence of certain node in these caches
before this change, they will not find those entries since this change
creates new caches.

* This commit also introduces an implicit assumption that bulk adding of
nodes can only be done to one NCM at a time. Even if each nodeinfo has a
distinct NCM id, NMM will pick the NCM Id from the first nodeinfo and
send the whole batch to that NCM (issue futurewei-cloud#601 is tracking this)

* Node creation via file upload was meant to be an admin task and was
not designed to dispatch those nodes to DPM and NCM. This commit
does not change this old behavior (issue futurewei-cloud#600 is tracking this)

Regular change notes:

* Node creation will continue to work if nodeinfo has no ncmid to be backward
compatible. Delete, update file upload, bulk add all are 100% backward
compatible if ndmid is missing.

* If ncmid is present, it must resolve to a registered NCM or an error will
be raised.

* Update integration test script (scripts/test/nmm-ncm-test.sh) with NCM
id/uri. UPDATE is also validated. Added node creation with no NCMID.

* Fix update/delete getting called through wrong methods in DPM/NCM rest
client code. Using rest template exchange method with correct HTTP
headers is required in those sites.
@xieus xieus changed the title Node Manager Interface for NCM Registration [Node Mgr] Node Manager Interface for NCM Registration Apr 23, 2021
@xieus xieus merged commit 455181e into futurewei-cloud:master Apr 23, 2021
Copy link
Contributor

@xieus xieus left a comment

Choose a reason for hiding this comment

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

New latest change looks good!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants