Skip to content

nkeulen/robotframework-netaddr

Repository files navigation

robotframework-netaddr

PyPi license PyPi downloads Latest Version

Description

Provides a class which wraps much of the netaddr (https://netaddr.readthedocs.io/en/latest/introduction.html) library functionality.

The wrapped functions are accesible within Robot Framework and can be used there as keywords.

Documentation

Keyword documentation can be found here: https://github.com/nkeulen/robotframework-netaddr/blob/master/documentation.md

How to install

The package can be installed using pip:

pip install robotframework-netaddr

How to use in robotframework

A quick demonstration of how this library can be used in robotframework:

*** Settings ***
Library    RobotFrameworkNetAddr

*** Test Cases ***
My Test Case
    # Check if an IP address is part of a subnet:
    ${subnet}    Set Variable    10.10.10.0/24
    ${ip}    Set Variable    10.10.10.123
    ${ip_in_subnet}    IPAddress In Network    ${ip}    ${subnet}
    Run Keyword If    ${ip_in_subnet}
    ...    Log To Console    \n${ip} is in ${subnet}    ELSE
    ...    Log To Console    \n${ip} is not in ${subnet}
    # Check a subnet mask:
    ${netmask}    IPNetwork Netmask    ${subnet}
    Should Be Equal As Strings    ${netmask}    255.255.255.0

About

Provides a class which wraps much of the python netaddr library functionality for access in robotframework.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages