[k8s-automation]: rt_number need to be treated as string

Bug #1763290 reported by Pulkit Tandon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R5.0
Fix Released
Critical
Pulkit Tandon
Trunk
Fix Released
Critical
Pulkit Tandon

Bug Description

In R5.0 contrail-test using "contrail_test_inputs.yaml" we use following format for setting router_asn and public_vn:
    router_asn: 64512
    public_rt: 2225

Whn contrail_test_init.py "parse_yml_file" reads them, it populates them as integer.

Earlier parse_ini_file used to read these values as a string.
Thus, the values self.mx_rt and self.router_asn are treated as string everywhere.
Treating them as integer can lead to issues as these variables have been used as string everywhere. Thus, changing it to a "str" variable.

For e.g., I landed into following issue:

======================================================================
ERROR: setUpClass (scripts.k8s_scripts.test_service.TestService)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "scripts/k8s_scripts/test_service.py", line 15, in setUpClass
    super(TestService, cls).setUpClass()
  File "common/k8s/base.py", line 52, in setUpClass
    api_option='contrail')
  File "tcutils/util.py", line 997, in __call__
    Singleton, cls).__call__(*args, **kwargs)
  File "common/create_public_vn.py", line 40, in __init__
    self.create_public_vn(mx_rt)
  File "common/create_public_vn.py", line 87, in create_public_vn
    assert self.public_vn_fixture.verify_on_setup()
  File "/contrail-test/fixtures/vn_test.py", line 579, in verify_on_setup
    if not self.verify_vn_in_api_server():
  File "tcutils/util.py", line 62, in f_retry
    result = f(*args, **kwargs) # first attempt
  File "/contrail-test/fixtures/vn_test.py", line 674, in verify_vn_in_api_server
    if not any(item.endswith(self.rt_number) for item in self.rt_names):
  File "/contrail-test/fixtures/vn_test.py", line 674, in <genexpr>
    if not any(item.endswith(self.rt_number) for item in self.rt_names):
TypeError: endswith first arg must be str, unicode, or tuple, not int

Reason:
(Pdb) self.rt_names
['target:64512:8000004', 'target:64512:2225']
(Pdb) self.rt_names[1]
'target:64512:2225'
(Pdb) self.rt_number
2225
(Pdb) self.rt_names[1].endswith(self.rt_number)
*** TypeError: endswith first arg must be str, unicode, or tuple, not int

This fails complete k8s sanity in a particular case where MX_GW_TEST=1

Tags: automation
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/41789
Submitter: Pulkit Tandon (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R5.0

Review in progress for https://review.opencontrail.org/41790
Submitter: Pulkit Tandon (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/41789
Submitter: Pulkit Tandon (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R5.0

Review in progress for https://review.opencontrail.org/41790
Submitter: Pulkit Tandon (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/41789
Committed: http://github.com/Juniper/contrail-test/commit/99ee7da708a07d23f49f8acad85d2b2a4c1ba762
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 99ee7da708a07d23f49f8acad85d2b2a4c1ba762
Author: Pulkit Tandon <email address hidden>
Date: Thu Apr 12 13:04:57 2018 +0530

Made mx_rt and rt_number as str so that they can be treated
in the same way when testbed.py was used.

Change-Id: I7270ef27af25dcb51051d09c6445510f9eef2640
Closes-bug: #1763290

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R5.0

Review in progress for https://review.opencontrail.org/41790
Submitter: Pulkit Tandon (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/41790
Committed: http://github.com/Juniper/contrail-test/commit/efe2062c84dad2729f28ce8576ad2902cd7d1f14
Submitter: Zuul v3 CI (<email address hidden>)
Branch: R5.0

commit efe2062c84dad2729f28ce8576ad2902cd7d1f14
Author: Pulkit Tandon <email address hidden>
Date: Thu Apr 12 13:04:57 2018 +0530

Made mx_rt and rt_number as str so that they can be treated
in the same way when testbed.py was used.

Change-Id: I7270ef27af25dcb51051d09c6445510f9eef2640
Closes-bug: #1763290

Revision history for this message
Pulkit Tandon (pulkitt) wrote :

Verified on Latest R5.0 release 16
Master release build

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.