cisco-open / cisco-catalyst-wan-sdk

Cisco Catalyst WAN SDK
Apache License 2.0
18 stars 3 forks source link

Get returns wrong type: Global[int](option_type=<OptionType.DEFAULT .... ) #827

Open jpkrajewski opened 2 months ago

jpkrajewski commented 2 months ago

Summary

The get returns Global[int](option_type=<OptionType.DEFAULT .... ) in many places.

The value should always be Global[int](option_type=<OptionType.GLOBAL .... )

Logs and external information

 def test_when_default_values_ospf_parcel_expect_successful_post(self):
        # Arrange
        ospf_parcel = RoutingOspfParcel(
            parcel_name="TestRoutingOspfParcel",
            parcel_description="Test Ospf Parcel",
        )
        # Act
        parcel_id = self.api.create_parcel(self.profile_uuid, ospf_parcel).id
        # Assert
        parcel = self.api.get_parcel(self.profile_uuid, RoutingOspfParcel, parcel_id)
        assert isinstance(parcel.payload, RoutingOspfParcel)
>       assert parcel.payload == ospf_parcel
E       AssertionError: assert RoutingOspfParcel(parcel_name='TestRoutingOspfParcel', parcel_description='Test Ospf Parcel', data=None, type_='routing/ospf', router_id=Default[NoneType](option_type=<OptionType.DEFAULT: 'default'>, value=None), reference_bandwidth=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=100), rfc1583=Global[bool](option_type=<OptionType.DEFAULT: 'default'>, value=True), originate=Global[bool](option_type=<OptionType.DEFAULT: 'default'>, value=False), always=None, metric=None, metric_type=None, external=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), inter_area=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), intra_area=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), delay=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=200), initial_hold=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=1000), max_hold=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=10000), redistribute=None, router_lsa=None, route_policy=None, area=None) == RoutingOspfParcel(parcel_name='TestRoutingOspfParcel', parcel_description='Test Ospf Parcel', data=None, type_='routing/ospf', router_id=Default[NoneType](option_type=<OptionType.DEFAULT: 'default'>, value=None), reference_bandwidth=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=100), rfc1583=Default[bool](option_type=<OptionType.DEFAULT: 'default'>, value=True), originate=Default[bool](option_type=<OptionType.DEFAULT: 'default'>, value=False), always=None, metric=None, metric_type=None, external=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), inter_area=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), intra_area=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), delay=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=200), initial_hold=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=1000), max_hold=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=10000), redistribute=None, router_lsa=None, route_policy=None, area=None)
E         Full diff:
E         - RoutingOspfParcel(parcel_name='TestRoutingOspfParcel', parcel_description='Test Ospf Parcel', data=None, type_='routing/ospf', router_id=Default[NoneType](option_type=<OptionType.DEFAULT: 'default'>, value=None), reference_bandwidth=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=100), rfc1583=Default[bool](option_type=<OptionType.DEFAULT: 'default'>, value=True), originate=Default[bool](option_type=<OptionType.DEFAULT: 'default'>, value=False), always=None, metric=None, metric_type=None, external=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), inter_area=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), intra_area=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), delay=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=200), initial_hold=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=1000), max_hold=Default[int](option_type=<OptionType.DEFAULT: 'default'>, value=10000), redistribute=None, router_lsa=None, route_policy=None, area=None)
E         ?                                                                                                                                                                                                                                          ^^^^^^^                                                                       ^^^^^^^                                                                           ^^^^^^^                                                                                                                       ^^^^^^^                                                                          ^^^^^^^                                                                          ^^^^^^^                                                                     ^^^^^^^                                                                            ^^^^^^^                                                                         ^^^^^^^
E         + RoutingOspfParcel(parcel_name='TestRoutingOspfParcel', parcel_description='Test Ospf Parcel', data=None, type_='routing/ospf', router_id=Default[NoneType](option_type=<OptionType.DEFAULT: 'default'>, value=None), reference_bandwidth=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=100), rfc1583=Global[bool](option_type=<OptionType.DEFAULT: 'default'>, value=True), originate=Global[bool](option_type=<OptionType.DEFAULT: 'default'>, value=False), always=None, metric=None, metric_type=None, external=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), inter_area=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), intra_area=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=110), delay=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=200), initial_hold=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=1000), max_hold=Global[int](option_type=<OptionType.DEFAULT: 'default'>, value=10000), redistribute=None, router_lsa=None, route_policy=None, area=None)
E         ?                                                                                                                                                                                                                                          ^^^^^^                                                                       ^^^^^^                                                                           ^^^^^^                                                                                                                       ^^^^^^                                                                          ^^^^^^                                                                          ^^^^^^                                                                     ^^^^^^                                                                            ^^^^^^                                                                         ^^^^^^

catalystwan/integration_tests/feature_profile/sdwan/test_service.py:209: AssertionError

Reproduction script

ospf_parcel = RoutingOspfParcel(
  parcel_name="TestRoutingOspfParcel",
  parcel_description="Test Ospf Parcel",
)
# Act
parcel_id = self.api.create_parcel(self.profile_uuid, ospf_parcel).id
# Assert
parcel = self.api.get_parcel(self.profile_uuid, RoutingOspfParcel, parcel_id)
assert isinstance(parcel.payload, RoutingOspfParcel)
assert parcel.payload == ospf_parce

On what platform(s) does it occur?

Linux

Issue Severity

Medium: There is a workaround