Skip to content

Commit

Permalink
feature: improvement use case (#12)
Browse files Browse the repository at this point in the history
Signed-off-by: tiny.x <[email protected]>
tiny-x authored Oct 23, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent e3cbfee commit ba210e9
Showing 3 changed files with 21 additions and 17 deletions.
32 changes: 16 additions & 16 deletions exec/model.go
Original file line number Diff line number Diff line change
@@ -71,48 +71,48 @@ func newNetworkCommandModelSpecForDocker() spec.ExpModelCommandSpec {
case *exec.DelayActionSpec:
action.SetExample(
`# Access to native 8080 and 8081 ports is delayed by 3 seconds, and the delay time fluctuates by 1 second
blade create docker network delay --time 3000 --offset 1000 --interface eth0 --local-port 8080,8081 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08
blade create docker network delay --time 3000 --offset 1000 --interface eth0 --local-port 8080,8081 --container-id ee54f1e61c08
# Local access to external 14.215.177.39 machine (ping www.baidu.com obtained IP) port 80 delay of 3 seconds
blade create docker network delay --time 3000 --interface eth0 --remote-port 80 --destination-ip 14.215.177.39 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08
blade create docker network delay --time 3000 --interface eth0 --remote-port 80 --destination-ip 14.215.177.39 --container-id ee54f1e61c08
# Do a 5 second delay for the entire network card eth0, excluding ports 22 and 8000 to 8080
blade create docker network delay --time 5000 --interface eth0 --exclude-port 22,8000-8080 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network delay --time 5000 --interface eth0 --exclude-port 22,8000-8080 --container-id ee54f1e61c08`)
case *exec.DropActionSpec:
action.SetExample(
`# Experimental scenario of network shielding
blade create docker network drop --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
`# Block incoming connection from the port 80
blade create docker network drop --source-port 80 --network-traffic in --container-id ee54f1e61c08`)
case *exec.DnsActionSpec:
action.SetExample(
`# The domain name www.baidu.com is not accessible
blade create docker network dns --domain www.baidu.com --ip 10.0.0.0 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network dns --domain www.baidu.com --ip 10.0.0.0 --container-id ee54f1e61c08`)
case *exec.LossActionSpec:
action.SetExample(`# Access to native 8080 and 8081 ports lost 70% of packets
blade create docker network loss --percent 70 --interface eth0 --local-port 8080,8081 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08
blade create docker network loss --percent 70 --interface eth0 --local-port 8080,8081 --container-id ee54f1e61c08
# The machine accesses external 14.215.177.39 machine (ping www.baidu.com) 80 port packet loss rate 100%
blade create docker network loss --percent 100 --interface eth0 --remote-port 80 --destination-ip 14.215.177.39 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08
blade create docker network loss --percent 100 --interface eth0 --remote-port 80 --destination-ip 14.215.177.39 --container-id ee54f1e61c08
# Do 60% packet loss for the entire network card Eth0, excluding ports 22 and 8000 to 8080
blade create docker network loss --percent 60 --interface eth0 --exclude-port 22,8000-8080 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08
blade create docker network loss --percent 60 --interface eth0 --exclude-port 22,8000-8080 --container-id ee54f1e61c08
# Realize the whole network card is not accessible, not accessible time 20 seconds. After executing the following command, the current network is disconnected and restored in 20 seconds. Remember!! Don't forget -timeout parameter
blade create docker network loss --percent 100 --interface eth0 --timeout 20 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network loss --percent 100 --interface eth0 --timeout 20 --container-id ee54f1e61c08`)
case *exec.DuplicateActionSpec:
action.SetExample(`# Specify the network card eth0 and repeat the packet by 10%
blade create docker network duplicate --percent=10 --interface=eth0 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network duplicate --percent=10 --interface=eth0 --container-id ee54f1e61c08`)
case *exec.CorruptActionSpec:
action.SetExample(`# Access to the specified IP request packet is corrupted, 80% of the time
blade create docker network corrupt --percent 80 --destination-ip 180.101.49.12 --interface eth0 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network corrupt --percent 80 --destination-ip 180.101.49.12 --interface eth0 --container-id ee54f1e61c08`)
case *exec.ReorderActionSpec:
action.SetExample(`# Access the specified IP request packet disorder
blade create docker network reorder --correlation 80 --percent 50 --gap 2 --time 500 --interface eth0 --destination-ip 180.101.49.12 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network reorder --correlation 80 --percent 50 --gap 2 --time 500 --interface eth0 --destination-ip 180.101.49.12 --container-id ee54f1e61c08`)
case *exec.OccupyActionSpec:
action.SetExample(`#Specify port 8080 occupancy
blade create docker network occupy --port 8080 --force --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08
blade create docker network occupy --port 8080 --force --container-id ee54f1e61c08
# The machine accesses external 14.215.177.39 machine (ping www.baidu.com) 80 port packet loss rate 100%
blade create docker network loss --percent 100 --interface eth0 --remote-port 80 --destination-ip 14.215.177.39 --blade-tar-file /root/chaosblade-0.6.0.tar.gz --container-id ee54f1e61c08`)
blade create docker network loss --percent 100 --interface eth0 --remote-port 80 --destination-ip 14.215.177.39 --container-id ee54f1e61c08`)
}
}
return networkCommandModelSpec
@@ -189,7 +189,7 @@ func newMemCommandModelSpecForDocker() spec.ExpModelCommandSpec {
for _, action := range memCommandModelSpec.Actions() {
v := interface{}(action)
switch v.(type) {
case exec.MemCommandModelSpec:
case *exec.MemLoadActionCommand:
action.SetLongDesc("The memory fill experiment scenario in docker container")
action.SetExample(
`# The execution memory footprint is 50%
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ go 1.13

require (
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/chaosblade-io/chaosblade-exec-os v0.7.0
github.com/chaosblade-io/chaosblade-exec-os v0.7.1-0.20201021100435-b0a9a54cce59
github.com/chaosblade-io/chaosblade-spec-go v0.7.0
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v0.0.0-20180612054059-a9fbbdc8dd87
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@ github.com/chaosblade-io/chaosblade-exec-os v0.6.1-0.20200927065130-0c862f860af4
github.com/chaosblade-io/chaosblade-exec-os v0.6.1-0.20200927065130-0c862f860af4/go.mod h1:DlrbABYAjnJy8hL02l1s8Lkwqab4vQqLQoP0hpuwWrs=
github.com/chaosblade-io/chaosblade-exec-os v0.7.0 h1:GAXbrOwQJBdLUN6pQTlRwJak4pGZI3lCyBhDJ6j+vOA=
github.com/chaosblade-io/chaosblade-exec-os v0.7.0/go.mod h1:KCWm8ZUqjOnZFJgNQFTK6xybPmKwekQZrTe5udLwxuQ=
github.com/chaosblade-io/chaosblade-exec-os v0.7.1-0.20201021020825-4c22bba74076 h1:r2CY/aX+v5PzxFxCaPtiIVJ1KDE0pWdPcJpE2Yp/e+Q=
github.com/chaosblade-io/chaosblade-exec-os v0.7.1-0.20201021020825-4c22bba74076/go.mod h1:KCWm8ZUqjOnZFJgNQFTK6xybPmKwekQZrTe5udLwxuQ=
github.com/chaosblade-io/chaosblade-exec-os v0.7.1-0.20201021100435-b0a9a54cce59 h1:7srybyo/DZ/Q5aVb+ZKZsyNFSzpsJH/Q47jSgCgZshA=
github.com/chaosblade-io/chaosblade-exec-os v0.7.1-0.20201021100435-b0a9a54cce59/go.mod h1:KCWm8ZUqjOnZFJgNQFTK6xybPmKwekQZrTe5udLwxuQ=
github.com/chaosblade-io/chaosblade-spec-go v0.4.0 h1:/ZRnT2XZDghSdRRQks3vlccRHCthT6One7fFDrCpSeE=
github.com/chaosblade-io/chaosblade-spec-go v0.4.0/go.mod h1:ybcCsIX1wZtPrH0IsI28yDNJ+AVPeDMUZlgw1HE++Ds=
github.com/chaosblade-io/chaosblade-spec-go v0.4.1-0.20200110072855-4f767ce4e582 h1:H1lQcUkTCxH8haUGTAkS/4GWXbIBuCrG0UDztLuQtUo=

0 comments on commit ba210e9

Please sign in to comment.