Skip to content

Issues fetching engine's routing_monitoring #77

@royf-dream

Description

@royf-dream

Hey,
I'm running SMC 7.1.1
API ver tested both 6.10 and 7.1
I'm running latest module ver (1.0.30)

When trying to fetch routing_monitoring as in the example code

engine = Engine('sg_vm')
for route in engine.routing_monitoring:
    route

code fail because server returns way more parameters than defined in

route = collections.namedtuple(
    "Route", "route_network route_netmask route_gateway route_type dst_if src_if, values"
)

In /core/route.py (Route)

class Route(SerializedIterable):
    def __init__(self, data):
        routes = data.get("routing_monitoring_entry", [])
        data = [{k: v for k, v in d.items() if k != "cluster_ref"} for d in routes]
        super(Route, self).__init__(data, route)

Filtering cluster_ref is not enough when the returned keys per route are:
['dst_if', 'route_gateway', 'route_netmask', 'route_network', 'route_type', 'src_if', 'CompId', 'DataType', 'Dstif', 'ReceptionTime', 'RouteGateway', 'RouteMetric', 'RouteNetmask', 'RouteNetwork', 'RouteNetworkIpAddrs', 'RouteType', 'SessionEvent']

it triggers an exception in model(**r)

class SerializedIterable(BaseIterable):
    def __init__(self, items, model):
        items = [model(**r) for r in items]
        super(SerializedIterable, self).__init__(items)

Is there a workaround or am I misusing the module for that purpose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions