Note: In Macvlan you are not able to ping or communicate with the default namespace IP address. For example, if you create a container and try to ping the Docker host’s eth0 it will not work. That traffic is explicitly filtered by the kernel modules themselves to offer additional provider isolation and security.
主机
123456789101112131415
[root@kube-master140 ~]# ip addr show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:40:2d:15 brd ff:ff:ff:ff:ff:ff
inet 192.168.191.140/24 brd 192.168.191.255 scope global dynamic ens33
valid_lft 1765sec preferred_lft 1765sec
inet6 fe80::1186:2fe5:9ee5:8790/64 scope link
valid_lft forever preferred_lft forever
[root@kube-worker141 ~]# ip addr show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:2e:67:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.191.141/24 brd 192.168.191.255 scope global dynamic ens33
valid_lft 1779sec preferred_lft 1779sec
inet6 fe80::dd23:1df6:b37:efae/64 scope link
valid_lft forever preferred_lft forever
创建网络
12345678910111213141516
[root@kube-worker141 ~]# docker network create \
-d macvlan \
--subnet=192.168.191.0/24 \
--gateway=192.168.191.2 \
-o parent=ens33 pub_net
4370998ed03024bc0057a894f1280d5b0fcdba526fd9e8da612a3abb0dbc884b
[root@kube-worker141 ~]# docker network list
NETWORK ID NAME DRIVER SCOPE
eee9236a36ba bridge bridge local
ddc7f59215c1 host host local
d8dc7fbc40a6 none null local
4370998ed030 pub_net macvlan local
[root@kube-worker141 ~]# docker network inspect pub_net
...
[root@kube-worker1 ~]# docker stop test21
test21
[root@kube-worker1 ~]# docker start test21
test21
[root@kube-worker1 ~]# pipework route test21 show
default via 172.18.0.1 dev eth0
172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.0.2
[root@kube-worker1 ~]# docker_container_ip test21 192.168.191.231/24 $GATEWAY
[root@kube-worker1 ~]# pipework route test21 show
default via 192.168.191.2 dev eth1
172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.0.2
192.168.191.0/24 dev eth1 proto kernel scope link src 192.168.191.231
[root@kube-worker1 ~]# docker exec test21 ping 192.168.191.140
STAF is an Open Source automation framework designed around the idea of reusable components. It is intended to make it
easier to create automated testcases and workloads. STAF can help you increase the efficiency, productivity, and quality of
your testing by improving your level of automation and reuse in your individual testcases as well as your overall test
environment.
STAF operates in a peer-to-peer environment; in other words, there is no client-server hierarchy among machines
running STAF.
Basic STAF Concepts
STAF Instances
Since multiple instances of STAF can be run at the same time on the same system, a STAF Instance name is used to
specify a name for each STAF instance. You specify the instance name to be used by setting the environment variable
STAF_INSTANCE_NAME. The default instance name is “STAF”.
A basic description of each level follows
123456
Level 0 - No access
Level 1 - Restricted access. Only PING and helps available.
Level 2 - Limited access. Only query/view facilities available.
Level 3 - Standard access. Non-destructive updates allowed, e.g., logging.
Level 4 - Advanced access. Update abilities, e.g., copying files, deleting log files.
Level 5 - All access, e.g., SHUTDOWN, Process invocation, Trust definition manipulation
STAF requests submitted from the command line are generally used to query information from STAF services.
STAF Commands
You can also start STAFProc by simply typing STAFProc at a command prompt
window. ( /usr/local/staf/bin is in your PATH )
[root@cdb1 staf]# staf local log log machine logname log1 level info message test-message
Response
--------
[root@cdb1 staf]# staf local log list machines
Response
--------
cdb1
[root@cdb1 staf]# staf local log query machine cdb1 logname log1
Response
--------
Date-Time Level Message
----------------- ----- ------------
20171006-10:54:33 Info test-message
#配置
[root@cdb1 staf]# echo "MACHINENICKNAME cdb1.dev" >>bin/STAF.cfg
[root@cdb1 staf]# staf local shutdown shutdown
[root@cdb1 staf]# ./startSTAFProc.sh
[root@cdb1 staf]# staf local log log machine logname log3 level info message test-message
Response
--------
[root@cdb1 staf]# staf local log list machines
Response
--------
cdb1
cdb1.dev
[root@cdb1 staf]# staf local log query machine cdb1.dev logname log3
Response
--------
Date-Time Level Message
----------------- ----- ------------
20171006-10:57:59 Info test-message
>>>> This primarily effects the data stored by
services such as the Log and Monitor services, which store data based on the machine from which it came by using the
STAF/Config/MachineNickname system variable as part of the directory path when creating logs and monitor data. By
allowing the STAF/Config/MachineNickname system variable to be overridden, it allows you to better manage your
data.
Note that the machine nickname is not used to communicate with other systems and does not have any effect on trust.
#配置
echo "SET DATADIR /data" >>bin/STAF.cfg
...
SET SYSTEM VAR Test/TestABC=websphere
SET SYSTEM VAR Test/TestXYZ=150
restart STAFProc and from a command prompt, try the STAF local var list command
TRUST LEVEL 2 DEFAULT
TRUST LEVEL 5 MACHINE 192.168.193.*
TRUST LEVEL 4 MACHINE tcp://9.3.41.*
TRUST LEVEL 5 MACHINE tcP://9.41.53.147
[root@cdb1 staf]# staf local trust list
Response
--------
Type Entry Trust Level
------- ----------------- -----------
Default <None> 2
Machine *://192.168.193.* 5
Machine local://local 5
Machine tcp://9.3.41.* 4
Machine tcP://9.41.53.147 5
Using the Help Service
1234567891011121314151617181920212223242526
[root@cdb1 staf]# staf local help help
Response
--------
*** HELP Service Help ***
REGISTER SERVICE <Name> ERROR <Number> INFO <String> DESCRIPTION <String>
UNREGISTER SERVICE <Name> ERROR <Number>
[SERVICE <Name>] ERROR <Number>
LIST SERVICES | [SERVICE <Name>] ERRORS
HELP
#错误码详情
[root@cdb1 staf]# staf local error list
Error submitting request, RC: 2
Additional info
---------------
error
[root@cdb1 staf]# staf local help error 2
Response
--------
Description: Unknown service
Details : You have tried to submit a request to a service that is unknown to STAFProc. Verify that you have correctly registered the service.
Registering STAF Services
12345678910111213141516171819
http://staf.sourceforge.net/getservices.php 下载EventV315.tar
[root@cdb1 staf]# tar xf EventV315.tar
[root@cdb1 staf]# vi bin/STAF.cfg
...
service Event library JSTAF execute /usr/local/staf/event/STAFEvent.jar
[root@cdb1 staf]# staf local shutdown shutdown
[root@cdb1 staf]# ./startSTAFProc.sh
[root@cdb1 staf]# staf local service list
Response
--------
Name Library Executable
--------- ---------- -----------------------------------
...
EVENT JSTAF /usr/local/staf/event/STAFEvent.jar
...
#帮助文档: http://staf.sourceforge.net/current/event.htm
Verify that the CLASSPATH environment variable contains the JSTAF.jar file. JSTAF.jar contains the STAF Java APIs
to communicate with STAF from Java programs and is required to register STAF services written in Java.
123456
[root@cdb1 staf]# tar xf ~/STAXV3517.tar
[root@cdb1 staf]# vi bin/STAF.cfg
...
SERVICE STAX LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/stax/STAX.jar OPTION J2=-Xmx2048m
SERVICE EVENT LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/stax/STAFEvent.jar
SET MAXQUEUESIZE 10000
If you do not want to include the JVM bin directory in your PATH, then you can use the
“OPTION JVM=xxx” to specify which Java executable to use for the services.
123456789
[root@cdb1 staf]# staf local stax version
Response
--------
3.5.17
[root@cdb1 staf]# staf local stax version jython
Response
--------
2.5.2-staf-v1
[root@cdb1 staf]#
Errors that occur when running the STAX service will be stored in its JVM log. This log is data/STAF/lang/java/jvm/STAFJVM1/JVMLog.1 in
your root STAF directory
source /etc/profile
cd stax
java -jar STAXMon.jar
>>>> You use script elements within your STAX jobs to define Python variables and execute Python code. However, also note that in most cases, all of
the element content and element attributes in your STAX jobs will also be evaluated as Python code.
<script>testName = 'CoolTest1'</script>
<testcase name="testName">
<testcase name="'%s Part A' % testName">
<testcase name="'%s Part A on machine %s' % (testName, machineName)">
#DoesNothing.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="main"/>
<function name="main">
<nop/>
</function>
</stax>
#generate dtd for xml editor
set STAF_QUIET_MODE=1 (or if on Unix: export STAF_QUIET_MODE=1)
STAF local STAX GET DTD > stax.dtd
set STAF_QUIET_MODE= (or if on Unix: unset STAF_QUIET_MODE)
#RunNotepadProcess.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="main"/>
<function name="main">
<process>
<location>'local'</location>
<command>'notepad'</command>
</process>
</function>
</stax>