Giter Club home page Giter Club logo

Comments (7)

thomasdevulder avatar thomasdevulder commented on July 25, 2024

Hello Fgazelot,

I tried to reproduce using SMC6.10 and Api 6.10 for me it works fine..
I am going to reproduce in SMC6.8 and Api 6.5 .....

my example script:

"""
Example script to show how to use Multilink
"""

# Python Base Import
import sys
from smc import session
from smc.elements.netlink import StaticNetlink, MultilinkMember, Multilink

if __name__ == '__main__':
    URLSMC='http://localhost:8082'
    APIKEYSMC='HuphG4Uwg4dN6TyvorTR0001'
    try:
        session.login(url=URLSMC, api_key=APIKEYSMC, verify=False, timeout=120, api_version='6.10')
    except BaseException as exception_retournee:
        sys.exit(-1)

    print("session OK")
try:
    # create multi link
    snl1 = StaticNetlink.create(name="SNL_Premier-ISP",
                                provider_name="ISP1",
                                output_speed=40000,
                                input_speed=40000,
                                probe_address=["10.1.16.1"],
                                network=["http://localhost:8082/6.10/elements/network/1684"],
                                gateway="http://localhost:8082/6.10/elements/router/1682",
                                connection_type="http://localhost:8082/6.10/elements/connection_type/1",
                                )
    snl2 = StaticNetlink.create(name="SNL_Second-ISP",
                                provider_name="ISP2",
                                output_speed=50000,
                                input_speed=50000,
                                probe_address=["172.31.16.1"],
                                network=["http://localhost:8082/6.10/elements/network/1678"],
                                gateway="http://localhost:8082/6.10/elements/router/1676",
                                connection_type="http://localhost:8082/6.10/elements/connection_type/1",
                                )

    print('SNL1\n', snl1.data.data)
    print('SNL2\n', snl2.data.data)

    print('SNL1.network\n', snl1.network)
    print('SNL2.network\n', snl2.network)
    l_ml_member = list()
    l_ml_member.append(MultilinkMember.create(netlink=snl1, netlink_role='active', ip_range='10.1.16.1-10.1.16.254'))
    l_ml_member.append(MultilinkMember.create(netlink=snl2, netlink_role='standby', ip_range='172.31.16.1-172.31.16.254'))

    oml = Multilink.create(name="OML_TEST",
                           multilink_members=l_ml_member)
    print('oml={} members={}'.format(str(oml), oml.members))
except Exception as e:
    print(e)
finally:
    oml = Multilink.get(name="OML_TEST")
    oml.delete()
    snl1 = StaticNetlink.get(name="SNL_Premier-ISP")
    snl1.delete()
    snl2 = StaticNetlink.get(name="SNL_Second-ISP")
    snl2.delete()
    session.logout()

return:

session OK
SNL1
 {'active_mode_period': 5, 'active_mode_timeout': 1, 'connection_type_ref': 'http://localhost:8082/6.10/elements/connection_type/1', 'domain_server_address': [], 'gateway_ref': 'http://localhost:8082/6.10/elements/router/1682', 'input_speed': 40000, 'key': 4372, 'link': [{'href': 'http://localhost:8082/6.10/elements/netlink/4372', 'rel': 'self', 'type': 'netlink'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4372/export', 'rel': 'export'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4372/history', 'rel': 'history'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4372/search_category_tags_from_element', 'rel': 'search_category_tags_from_element'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4372/duplicate', 'rel': 'duplicate'}], 'name': 'SNL_Premier-ISP', 'network_ref': ['http://localhost:8082/6.10/elements/network/1684'], 'nsp_name': 'ISP1', 'output_speed': 40000, 'probe_address': ['10.1.16.1'], 'read_only': False, 'standby_mode_period': 3600, 'standby_mode_timeout': 30, 'system': False, 'system_key': -1}
SNL2
 {'active_mode_period': 5, 'active_mode_timeout': 1, 'connection_type_ref': 'http://localhost:8082/6.10/elements/connection_type/1', 'domain_server_address': [], 'gateway_ref': 'http://localhost:8082/6.10/elements/router/1676', 'input_speed': 50000, 'key': 4373, 'link': [{'href': 'http://localhost:8082/6.10/elements/netlink/4373', 'rel': 'self', 'type': 'netlink'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4373/export', 'rel': 'export'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4373/history', 'rel': 'history'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4373/search_category_tags_from_element', 'rel': 'search_category_tags_from_element'}, {'href': 'http://localhost:8082/6.10/elements/netlink/4373/duplicate', 'rel': 'duplicate'}], 'name': 'SNL_Second-ISP', 'network_ref': ['http://localhost:8082/6.10/elements/network/1678'], 'nsp_name': 'ISP2', 'output_speed': 50000, 'probe_address': ['172.31.16.1'], 'read_only': False, 'standby_mode_period': 3600, 'standby_mode_timeout': 30, 'system': False, 'system_key': -1}
SNL1.network
 [Network(name=net-10.1.16.0/24)]
SNL2.network
 [Network(name=net-172.31.16.0/24)]
oml=Multilink(name=OML_TEST) members=[MultilinkMember(netlink=StaticNetlink(name=SNL_Premier-ISP),netlink_role=active,ip_range=10.1.16.1-10.1.16.254), MultilinkMember(netlink=StaticNetlink(name=SNL_Second-ISP),netlink_role=standby,ip_range=172.31.16.1-172.31.16.254)]

Process finished with exit code 0

from fp-ngfw-smc-python.

thomasdevulder avatar thomasdevulder commented on July 25, 2024

I could reproduce the issue using SMC 6.8.5 and Api v6.5

SNL1
 {'active_mode_period': 5, 'active_mode_timeout': 1, 'domain_server_address': [], 'gateway_ref': 'http://localhost:8082/6.5/elements/router/1682', 'input_speed': 40000, 'key': 4054, 'link': [{'href': 'http://localhost:8082/6.5/elements/netlink/4054', 'rel': 'self', 'type': 'netlink'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4054/export', 'rel': 'export'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4054/history', 'rel': 'history'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4054/search_category_tags_from_element', 'rel': 'search_category_tags_from_element'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4054/duplicate', 'rel': 'duplicate'}], 'name': 'SNL_Premier-ISP', 'nsp_name': 'ISP1', 'output_speed': 40000, 'probe_address': ['10.1.16.1'], 'read_only': False, 'ref': ['http://localhost:8082/6.5/elements/network/1684'], 'standby_mode_period': 3600, 'standby_mode_timeout': 30, 'system': False, 'system_key': -1}
SNL2
 {'active_mode_period': 5, 'active_mode_timeout': 1, 'domain_server_address': [], 'gateway_ref': 'http://localhost:8082/6.5/elements/router/1676', 'input_speed': 50000, 'key': 4055, 'link': [{'href': 'http://localhost:8082/6.5/elements/netlink/4055', 'rel': 'self', 'type': 'netlink'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4055/export', 'rel': 'export'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4055/history', 'rel': 'history'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4055/search_category_tags_from_element', 'rel': 'search_category_tags_from_element'}, {'href': 'http://localhost:8082/6.5/elements/netlink/4055/duplicate', 'rel': 'duplicate'}], 'name': 'SNL_Second-ISP', 'nsp_name': 'ISP2', 'output_speed': 50000, 'probe_address': ['172.31.16.1'], 'read_only': False, 'ref': ['http://localhost:8082/6.5/elements/network/1678'], 'standby_mode_period': 3600, 'standby_mode_timeout': 30, 'system': False, 'system_key': -1}
SNL1.network
 []
SNL2.network
 []

I open an issue in GitHub Enterprise and make the fix in order to retrieve correctly network field..

Thanks.

from fp-ngfw-smc-python.

fgazelot avatar fgazelot commented on July 25, 2024

Hello,

Thank you for taking the time to check.

I'm waiting for a fix then :)

Thanks,
Fgazelot

from fp-ngfw-smc-python.

fgazelot avatar fgazelot commented on July 25, 2024

Hello thomasdevulder,

I hope all is well.

Do you have any update for me about the issue in GitHub Enterprise ?

Kind regards,
FGazelot

from fp-ngfw-smc-python.

thomasdevulder avatar thomasdevulder commented on July 25, 2024

Hello,
this issue was a more general issue related to get_best_version method and was fixed and merged in our GitHub Enterprise.
It will be published to GitHub.com in next release, I think next week.

from fp-ngfw-smc-python.

thomasdevulder avatar thomasdevulder commented on July 25, 2024

This was fixed in 1.0.2 version

from fp-ngfw-smc-python.

fgazelot avatar fgazelot commented on July 25, 2024

Hello thomasdevulder,

Thanks for this fix !
Kind regards,
FGazelot

from fp-ngfw-smc-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.