Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

From PicOS2.9.1, user can add customized scripts which will run automatically upon system boot up.

...

The files pre-nos/ post-xorplus/ post-ovs are not existing in directory /cftmp/auto defaultly. If user want to run the scripts, they need to create them and make sure they are read and write files.

 

Example 1:

Run script when Linux booting over.

...

Code Block
admin@PicOS-OVS$sudo touch /cftmp/auto/post-ovs
admin@PicOS-OVS$sudo chmod 777 /cftmp/auto/post-ovs
admin@PicOS-OVS$sudo vi /cftmp/auto/post-ovs
echo "Start add ovs scripts"
ovs-vsctl del-br br0
ovs-vsctl add-br br0
ovs-vsctl add-port br0 te-1/1/1
ovs-vsctl add-port br0 te-1/1/2
ovs-vsctl add-port br0 te-1/1/3
ovs-ofctl add-group br0 group_id=1,type=select,bucket=output:2,bucket=output:3
ovs-ofctl add-meter br0 meter=1,kbps,stats,band=type=drop,rate=10000
ovs-ofctl add-flow br0 in_port=1,actions=meter:1,group:1
echo "Add ovs scripts finished"
 
admin@PicOS-OVS$sudo /etc/init.d/picossystemctl restart [....] Stopping web server: lighttpd.
[picos
.....] Stopping: Open vSwitch/OpenFlowdevice ovs-pica8 left promiscuous mode
...
[....] Stopping enhanced syslogd: rsyslogd.
[....] Starting enhanced syslogd: rsyslogd.
[....] Stopping internet superserver: xinetd.
[....] Restarting OpenBSD Secure Shell server: sshd.
[....] Starting web server: lighttpd.
[....] Starting network snmp: snmpd.
[....] Starting: Open vSwitch/OpenFlow.
Start add ovs scripts
ovs-vsctl: no bridge named br0
device ovs-pica8 entered promiscuous mode
device br0 entered promiscuous mode
Add ovs scripts finished
admin@OVS$
 

 

Example 3:

Run script when Xorplus is ready.

Code Block
admin@XorPlus$sudo touch /cftmp/auto/post-xorplus
admin@XorPlus$sudo chmod 777 /cftmp/auto/post-xorplus
admin@XorPlus$sudo vi /cftmp/auto/post-xorplus
echo "Start add xorplus scripts"
/pica/bin/cli -c 'configure;
set interface gigabit-ethernet te-1/1/1 crossflow enable true;
set interface gigabit-ethernet te-1/1/1 crossflow local-control false;
set interface gigabit-ethernet te-1/1/2 crossflow enable true;
set interface gigabit-ethernet te-1/1/2 crossflow local-control false;
set interface gigabit-ethernet te-1/1/3 crossflow enable true;
set xovs enable true;
commit'
ovs-vsctl del-br br0
ovs-vsctl add-br br0
ovs-vsctl add-port br0 te-1/1/1
ovs-vsctl add-port br0 te-1/1/2
ovs-vsctl add-port br0 te-1/1/3 -- set interface te-1/1/3 type=crossflow
ovs-ofctl add-group br0 group_id=1,type=select,bucket=output:2,bucket=output:3
ovs-ofctl add-meter br0 meter=1,kbps,stats,band=type=drop,rate=10000
ovs-ofctl add-flow br0 in_port=1,actions=meter:1,group:1
echo "Add xorplus scripts finished"
 
admin@XorPlus$sudo /etc/init.d/picos restart
[....] Stopping: L2/L3...............
[....] Starting: L2/L3........................
admin@PicOS-OVS$sudo systemctl restart picos
.......................
Start add xorplus scripts
Synchronizing configuration...OK.
Luxar Tech LNOS Version 2.9.1
Welcome to LNOS on XorPlus
root@XorPlus> 
Execute command: configure.
Entering configuration mode.
There are no other users in configuration mode.
root@XorPlus# 
Execute command: 
set interface gigabit-ethernet te-1/1/1 crossflow enable true.
root@XorPlus# 
Execute command: 
set interface gigabit-ethernet te-1/1/1 crossflow local-control false.
root@XorPlus# 
Execute command: 
set interface gigabit-ethernet te-1/1/2 crossflow enable true.
root@XorPlus# 
Execute command: 
set interface gigabit-ethernet te-1/1/2 crossflow local-control false.
root@XorPlus# 
Execute command: 
set interface gigabit-ethernet te-1/1/3 crossflow enable true.
root@XorPlus# 
Execute command: 
set xovs enable true.
root@XorPlus# 
Execute command: 
commit
.
Commit OK.
Save done.
root@XorPlus# 
ovs-vsctl: no bridge named br0
device ovs-pica8 entered promiscuous mode
device br0 entered promiscuous mode
Add xorplus scripts finished
admin@XorPlus$

 

...