Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe for network testing #1322

Merged
merged 22 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fecd331
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jun 11, 2020
9ab1df3
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jun 12, 2020
8206f27
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jun 14, 2020
39fe517
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jun 25, 2020
58c0d37
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jun 26, 2020
9460f61
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jul 2, 2020
5291d9d
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jul 8, 2020
7e07bdd
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jul 13, 2020
10930c0
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jul 21, 2020
06f244f
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jul 25, 2020
a8cd1c1
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke Jul 29, 2020
436f021
Added recipe for network disruption testing. Updated gen_toplogy.py …
egieseke Jul 30, 2020
7bd4e2f
Created network-partion recipe with gen_topology.py to support group …
egieseke Jul 30, 2020
fff127d
Updated random number limits and fixed regions array.
egieseke Jul 30, 2020
5ed966d
Added generation of group files to specify nodes in each group.
egieseke Jul 30, 2020
1be4260
Adjust docker/build/Docker-deploy GOPROXY environment var to single p…
egieseke Jul 31, 2020
7b4fdf8
Update gen_topology.py script to exit on error.
egieseke Jul 31, 2020
df75603
Removed commented code and added comments.
egieseke Jul 31, 2020
58bbaa4
Removed default group name. Now defaults to "".
egieseke Aug 3, 2020
ebbdb4d
Removed extra white space.
egieseke Aug 6, 2020
552139d
Added back multipath GOPROXY setting since we will upgrade to
egieseke Aug 19, 2020
7dc1ab2
Removed extra whitespace.
egieseke Aug 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/build/Dockerfile-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /root
RUN wget --quiet https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz && tar -xvf go${GOLANG_VERSION}.linux-amd64.tar.gz && mv go /usr/local
ENV GOROOT=/usr/local/go \
GOPATH=$HOME/go \
GOPROXY=https://gocenter.io,https://goproxy.io,direct
GOPROXY=https://gocenter.io
onetechnical marked this conversation as resolved.
Show resolved Hide resolved
RUN mkdir -p $GOPATH/src/github.com/algorand
WORKDIR $GOPATH/src/github.com/algorand
COPY . ./go-algorand/
Expand Down
10 changes: 10 additions & 0 deletions netdeploy/remote/deployedNetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ type cloudHostConfiguration struct {

type cloudHostSpec struct {
Name string
Group string
Provider string
Region string
InstanceType string
Expand Down Expand Up @@ -404,6 +405,14 @@ func (cfg DeployedNetwork) GenerateCloudTemplate(templates HostTemplates, target
if err != nil {
return
}

group := strings.TrimSpace(cloudHost.Group)
if group == "" {
hostSpec.Group = "default"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For backward compatibility, you might want to leave the default as an empty string.
This would force the cloudspec file consumer to populate it with "default" instead of expecting a non-empty string.
( i.e. currently, all cloud-spec files doesn't have this field. )

If you're going to break backward compatibility, please add versioning to the cloud spec file so we can detect that forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave default as an empty string.

} else {
hostSpec.Group = group
}

topology.Hosts = append(topology.Hosts, hostSpec)
}

Expand Down Expand Up @@ -488,6 +497,7 @@ func createHostSpec(host HostConfig, template cloudHost) (hostSpec cloudHostSpec
}

hostSpec.Name = host.Name
hostSpec.Group = host.Group
hostSpec.Provider = template.Provider
hostSpec.Region = template.Region
hostSpec.InstanceType = template.BaseConfiguration
Expand Down
1 change: 1 addition & 0 deletions netdeploy/remote/hostConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ package remote
// HostConfig represents the configuration of a single deployed Host
type HostConfig struct {
Name string
Group string
Nodes []NodeConfig
}
1 change: 1 addition & 0 deletions netdeploy/remote/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

type cloudHostType struct {
Name string
Group string
Template string
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need such a big network to conduct a partitioning test ?
I don't really see how the large network would help us getting the answer "does the network recover after partitioning? and after how long ?"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can adjust the network to be smaller. The github tickets ask for all 3 scenarios.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. It's that I just don't want you to get delayed by "deployment issues" that aren't related to the actual test you're trying to conduct.. Having the feedback that it's broken on small network is more valuable than the fact the it's broken on a large network ( and would probably be easier to evaluate )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we will start testing tomorrow.


all: net.json genesis.json

net.json: node.json nonPartNode.json ${GOPATH}/bin/netgoal
netgoal generate -t net -r /tmp/wat -o net.json ${PARAMS}

genesis.json: ${GOPATH}/bin/netgoal
netgoal generate -t genesis -r /tmp/wat -o genesis.json ${PARAMS}

clean:
rm -f net.json genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import random

node_types = {"R":8, "N":20, "NPN":10}
node_size = {"R":"-m5d.4xl", "N":"-m5d.4xl", "NPN":"-m5d.4xl"}
partitions = {"A":50, "B":20, "C":10, "D":10, "E":5, "F":5}
regions = [
"AWS-US-EAST-2",
"AWS-US-WEST-1"
]

def gen_topology(ranges):
f = open("topology.json", "w")
f.write("{ \"Hosts\":\n [")
node_groups = {}

region_count = len(regions)
first = True
for x in node_types:
node_type = x
node_count = node_types[x]
region_size = node_size[x]
for i in range(node_count):
node_name = node_type + str(i+1)
region = regions[i%region_count]
# randomly assign the node to a partition
partition = get_partition(ranges)
node_groups.setdefault(partition,[]).append(node_name);
if (first ):
first = False
else:
f.write(",")
f.write ("\n {\n \"Name\": \"" + node_name + "\",\n \"Group\": \"" + partition + "\",\n \"Template\": \"" + region + region_size + "\"\n }" )

f.write("\n ]\n}\n")
f.close()

for node_group in node_groups:
f = open("group_" + node_group + ".txt", "w")
for node in node_groups[node_group]:
f.write(node +"\n")
f.close()


def get_partition(ranges):
random_value = random.randint(1,100)
for partition_name in ranges:
partition_value = ranges[partition_name]
if random_value >= partition_value['start'] and random_value <= partition_value['end'] :
return partition_name
print("error, partition not found for random_value ", random_value)
exit(1)

def get_ranges():
ranges = {}
start_pos = 1;
for name, size in partitions.items():
if (start_pos > 100) :
print("error, range exceeded 100")
exit(1)
end_pos = start_pos + size - 1
ranges[name] = {"start": start_pos, "end": end_pos}
start_pos = end_pos + 1
print(ranges)
return ranges

ranges = get_ranges()

# for i in range(10):
# partition_name = get_partition(ranges)
# print(i, partition_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete deadcode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.


gen_topology(ranges)
Loading