Ethernet Switching
Ethernet Switching

Copy & Paste from text file to CLI?

‎03-19-2010 12:21 PM

Hello

  Is there a way to remove/add line items within an existing config? (via non-active config)

oh say I want to convert multiple access ports to trunk ports and add multiple vlans. (Vlans are already defined)

 

I know I can manually specify the set commands for each interface, but is there a way to cut and paste pieces of line items from a text file and past it onto the config via CLI?

 

Similar to the way it's done with Cisco switches and routers.

Thanks

 

I've tried "load merge terminal" and "load override terminal" but it always generates syntax errors.

I've also tried cutting and pasting multiple set commands via the config mode but once again I receive erorrs. Seems

when I paste, the CLI interprets LF at various points within the syntax lines.

 

Thank you

 

 

5 REPLIES 5
Ethernet Switching

Re: Copy & Paste from text file to CLI?

‎03-19-2010 02:17 PM

Hi what you want to acheive is quite very simple and often used by everyone.

 

here is a simple example for you typed on a real EX switch:

 

let say i want to copy port ge-0/0/7 configuration on port ge-0/0/8:

 

Alain@EX3200_Ala# show interfaces ge-0/0/7    
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members [ red blue green ];
        }
    }
}
Alain@EX3200_Ala# edit interfaces ge-0/0/8 
[edit interfaces ge-0/0/8]
Alain@EX3200_Ala# edit interfaces ge-0/0/8 
[edit interfaces ge-0/0/8]
user@EX3200# show 
unit 0 {
    family ethernet-switching;
}
[edit interfaces ge-0/0/8]
user@EX3200# load merge terminal relative    
[Type ^D at a new line to end input]
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members [ red blue green ];
        }
    }
}
                                            copy paste the red lines from the other ports and then type ctrl D 
load complete
[edit interfaces ge-0/0/8]
user@EX3200# show 
unit 0 {
    family ethernet-switching {
        port-mode trunk;
        vlan {
            members [ red blue green ];
        }
    }
}

 

Here it's done.

 

If this don't work for you i think you're doing something wrong, perhaps your terminal emulator is configured the wrong way, try to use htperterminal with the default config on the console port with just the seed modified.

 

Try also to have a look at the online trainings that are on the juniper web site or at the several books you can find for free

 

Hope this will help you


 

Ethernet Switching

Re: Copy & Paste from text file to CLI?

‎03-19-2010 03:23 PM

 


@93lt1 wrote:

 

I've tried "load merge terminal" and "load override terminal" but it always generates syntax errors.

I've also tried cutting and pasting multiple set commands via the config mode but once again I receive erorrs. Seems

when I paste, the CLI interprets LF at various points within the syntax lines.

 


 

 

Usually this happens when CLI line buffer does not keep up to speed with character stream it is receiving. If you are using Hyperterm/Putty, try to copy-paste only few lines at a time. Or switch to SecureCRT and configure Line Send Delay/Character Send Delay of 3-5 msec.

Alternatively, you can write your config into a file and then load it using "load set" command. One limitation is that You cannot put annotations in config this way.

HTH

Rgds

Alex

_____________________________________________________________________

Please ask Your Juniper account team about Juniper Professional Services offerings.
Juniper PS can design, test & build the network/part of the network as per Your requirements

+++++++++++++++++++++++++++++++++++++++++++++

Accept as Solution = cool !
Accept as Solution+Kudo = You are a Star !
Ethernet Switching

Re: Copy & Paste from text file to CLI?

‎03-26-2010 07:31 AM

 

Also note that you can do a "show | display set" in configuration mode. This will output the actual set commands. Its not as nice to read but now you can just paste into the terminal. Be sure to do "top" before pasting has the commands displayed have the entire stanza path in them.

 

/Rikard

 

Example:

{master:3}[edit interfaces]
rikard@ex3-rikard# show | display set    
set interfaces interface-range internal member-range ge-2/0/2 to ge-2/0/23
set interfaces interface-range internal unit 0 family ethernet-switching port-mode access
set interfaces interface-range internal unit 0 family ethernet-switching vlan members internal
set interfaces ge-0/0/0 unit 0 family ethernet-switching
set interfaces ge-0/0/1 unit 0 family ethernet-switching
set interfaces ge-0/0/2 vlan-tagging
set interfaces ge-0/0/2 unit 10 vlan-id 10
set interfaces ge-0/0/2 unit 10 family inet address 10.0.10.1/30

 

Ethernet Switching

Re: Copy & Paste from text file to CLI?

‎03-30-2010 12:09 PM

Fantastic...  I cannot say enough how valuable your inputs are to this forum.

When combining this resource and  working more with Juniper devices, the easier it's getting.

 

Thank you

Ex-Cisco SE.

 

 

 

Ethernet Switching

Re: Copy & Paste from text file to CLI?

‎08-30-2018 09:00 AM

so the steps would be

show | display set | no-more

// You get the whole configs for the CPE in the set format.

 

The next step would be to do the 

top load set terminal

// copy and past the configs here.

 

commit check and watch for any error

if not, then do the coomit and quit 

and you are done.

// Take another show | no-more 

// save a log and good to go.

 

Thanks all

Imran