Skip to content

Refactor all tests to use put_config_dicts #1237

@mattiaswal

Description

@mattiaswal

Description

And then remove the implementation for put_config_dict.
Sometimes tests set the hostname, that is not needed with put_config_dicts, if a hostname setting exist, remove it as well. (of course not when testing hostname changes :))

this is not a search and replace job, you need to identify the intention of each test, so test coverage is not lost. But
where applicable, send multiple models in the same query e.g, from ospf_multiarea:

def config_target4(target, ring1, cross, link):
    target.put_config_dicts({
        "ietf-interfaces": {
            "interfaces": {
                "interface": [
                    {
                        "name": ring1,
                        "enabled": True,
                        "ipv4": {
                            "forwarding": True,
                            "address": [{
                                "ip": "10.0.41.1",
                                "prefix-length": 30
                            }]}
                    },
                    {
                        "name": cross,
                        "enabled": True,
                        "ipv4": {
                            "forwarding": True,
                            "address": [{
                                "ip": "10.0.24.2",
                                "prefix-length": 30
                            }]}
                    },
                    {
                        "name": link,
                        "enabled": True,
                        "ipv4": {
                            "forwarding": True,
                            "address": [{
                                "ip": "192.168.4.1",
                                "prefix-length": 24
                            }]
                        }
                    },
                    {
                        "name": "lo",
                        "enabled": True,
                        "ipv4": {
                            "address": [{
                                "ip": "10.0.0.4",
                                "prefix-length": 32
                            }]
                        }
                    }
                ]
            }
        },
        "ietf-routing": {
            "routing": {
                "control-plane-protocols": {
                    "control-plane-protocol": [
                        {
                            "type": "infix-routing:ospfv2",
                            "name": "default",
                            "ospf": {
                                "explicit-router-id": "10.0.0.4",
                                "redistribute": {
                                    "redistribute": [{
                                            "protocol": "connected"
                                        }]
                                },
                                "areas": {
                                    "area": [{
                                        "area-id": "0.0.0.2",
                                        "interfaces": {
                                            "interface": [{
                                                "bfd": {
                                                    "enabled": True
                                                },
                                                "name": ring1,
                                                "hello-interval": 1,
                                                "enabled": True,
                                                "interface-type": "point-to-point"
                                            }, {
                                                "bfd": {
                                                    "enabled": True
                                                },
                                                "name": cross,
                                                "hello-interval": 1,
                                                "enabled": True,
                                                "cost": 5000
                                            }, {
                                                "name": "lo",
                                                "enabled": True
                                            }]
                                        }
                                    }]
                                }
                            }
                        }
                    ]
                }
            }
        }
    })
 

Additional Information

No response

General Information

Anyone can help out by sponsoring development of new features or contributing pull requests.
Please use this issue for discussions related to the feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerstestRegression test related

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions