Skip to content
Snippets Groups Projects
Select Git revision
  • 2.0.0
  • main default protected
  • features/demoIEEEVR_enhanced
  • features/demoIEEEVR
  • develop
5 results

packages.config

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test.py 1.87 KiB
    from ncclient import manager
    
    
    media_channel = ''' 
    <config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">  
        <wavelength-router xmlns="http://openconfig.net/yang/wavelength-router">    
            <media-channels>      
                <channel operation="create">        
                <index>2</index>       
                    <config>          
                    <name>C_BAND</name>          
                    <optical-band-parent xmlns="http://flex-scale-project.eu/yang/flex-scale-mg-on">1</optical-band-parent>          
                    <index>2</index>          
                    <lower-frequency>192006251</lower-frequency>          
                    <upper-frequency>192056250</upper-frequency>       
                    </config>        
                <dest>          
                    <config>            
                    <port-name>2</port-name>          
                    </config>        
                </dest>      
                </channel>    
            </media-channels>  
        </wavelength-router>
    </config>
    
    '''
    
    
    
    
    
    
    # Define device connection details
    device = {
        'host': '10.0.2.4',  # replace with the target device's hostname or IP address
        'port': 2026,               # NETCONF default port
        'username': 'admin', # replace with your username
        'password': 'admin', # replace with your password
        'hostkey_verify': False ,   # disable host key verification (use only for testing)
    
        
        "look_for_keys": False,
        "allow_agent": False,
    
        "device_params": {
                    "name": "default"
                    },
    }
    
    # Establish a NETCONF connection
    with manager.connect(**device) as m:
        print("Connected to the device successfully!")
        config = m.get_config(source='running').data_xml
      
        print("Device Configuration:")
        with open('d.log', 'w') as log_file:
            print(config,file=log_file)
        # result = m.edit_config(target='running', config=media_channel)
        # print (result)