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

[Data Plane Manager] UT Test Automation #394

Merged
merged 195 commits into from
Oct 7, 2020

Conversation

kevin-zhonghao
Copy link
Contributor

Completed DPM's UT test automation

List<NeighborInfo> neighborINFO = new ArrayList<>();
if (hasNeighbor) {
for (int i = 0; i < neighborNum; i ++) {
NeighborInfo neighborInfo = new NeighborInfo("10.213.43.18" + i, "ephost_0", "f37810eb-7f83-45fa-a4d4-1b31e75399d" + i, "86:ea:77:ad:52:55", "192.168.2.2", "9192a4d4-ffff-4ece-b3f0-8d36e3d88038", "a87e0f87-a2d9-44ef-9194-9a62f1785940");
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider to keep these test parameters in a file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

NP

@xieus xieus added the unit test Unit test label Oct 2, 2020
@xieus xieus added this to the Version 1.0.2020.11.30 milestone Oct 2, 2020
@@ -84,13 +84,13 @@ private void buildVpcState(NetworkConfiguration networkConfig, GoalState.Builder
}

for (PortState portState: portStates) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@chenpiaoping, please help review this file change. Let me know if there is any concern.

for (int j = 0; j < hostNum; j ++) {
for (int i = 0; i < portNum; i ++) {
List<PortEntity.FixedIp> fixedIps = new ArrayList<>();
PortEntity.FixedIp fixedIp = new PortEntity.FixedIp(DPMAutoUnitTestConstant.subnetId + i, DPMAutoUnitTestConstant.IpAddress + i);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make each port fall into a different subnet. Don't think it is needed. Let us have a quick sync up. @kevin-zhonghao

@xieus xieus changed the title [Data-Plane-Manager] Auto Test Implementation [Data Plane Manager] UT Test Automation Oct 3, 2020
null, false, null, null, 0, null, null,
false, false);

List<RouteEntity> routeEntities = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to use latest contract in PR #396

List<NeighborInfo> neighborINFO = new ArrayList<>();
if (hasNeighbor) {
for (int i = 0; i < neighborNum; i ++) {
NeighborInfo neighborInfo = new NeighborInfo(DPMAutoUnitTestConstant.hostIp + i, DPMAutoUnitTestConstant.hostId, DPMAutoUnitTestConstant.portId + i, DPMAutoUnitTestConstant.portMac, DPMAutoUnitTestConstant.portIp, DPMAutoUnitTestConstant.vpcId, DPMAutoUnitTestConstant.subnetId + i);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use DPMAutoUnitTestConstant.portMac and DPMAutoUnitTestConstant.portIp, do that mean that we are generating multiple neighbor ports with same IP and MAC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because we assume there is one neighbor if it has neighbor in most of cases. Do we have the case to test multiple neighbor with different IP and MAC?

List<NeighborInfo> neighborINFO = new ArrayList<>();
if (hasNeighbor) {
for (int i = 0; i < neighborNum; i ++) {
NeighborInfo neighborInfo = new NeighborInfo(DPMAutoUnitTestConstant.hostIp + i, DPMAutoUnitTestConstant.hostId, DPMAutoUnitTestConstant.portId + i, DPMAutoUnitTestConstant.portMac, DPMAutoUnitTestConstant.portIp, DPMAutoUnitTestConstant.vpcId, DPMAutoUnitTestConstant.subnetId + i);
Copy link
Contributor

Choose a reason for hiding this comment

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

Subnet generation shouldn't reply on DPMAutoUnitTestConstant.subnetId + i.

This means that if neighborNum=N, we will have N neighbor port, each will be in a different subnet. Subnet size is always one, and basically against the following code to generate neighborTable (using NumOfIPsInSubnet1 and NumOfIPsInSubnet2).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right, I will fix value of the subnet id

@codecov-io
Copy link

codecov-io commented Oct 7, 2020

Codecov Report

Merging #394 into master will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #394      +/-   ##
============================================
+ Coverage     36.78%   36.82%   +0.03%     
- Complexity     1149     1152       +3     
============================================
  Files           447      447              
  Lines         10703    10703              
  Branches       1365     1365              
============================================
+ Hits           3937     3941       +4     
+ Misses         6232     6230       -2     
+ Partials        534      532       -2     
Impacted Files Coverage Δ Complexity Δ
...alcor/elasticipmanager/dao/ElasticIpAllocator.java 63.81% <0.00%> (+0.27%) 48.00% <0.00%> (ø%)
...rewei/alcor/portmanager/processor/PortContext.java 69.09% <0.00%> (+1.81%) 23.00% <0.00%> (+1.00%)
...i/alcor/portmanager/processor/RouterProcessor.java 84.37% <0.00%> (+6.25%) 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 f1bc357...9ba72f0. Read the comment docs.

@xieus xieus self-requested a review October 7, 2020 21:46
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.

Thank you @kevin-zhonghao This PR is a very good improvement and one step towards a fully automated tests for DPM.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
unit test Unit test
Projects
None yet
4 participants