networkop / k8s-topo

Topology builder for network simulations inside K8S
BSD 3-Clause "New" or "Revised" License
72 stars 18 forks source link

UnboundLocalError: local variable '_' referenced before assignment #11

Closed grese closed 4 years ago

grese commented 4 years ago

I just installed k8s-topo on OS X, and I'm seeing this error when I try to run k8s-topo --create examples/3node-host.yml:

"UnboundLocalError: local variable '_' referenced before assignment"

It seems to be thrown from this line: line 360, in expand_links myendpoint = (self.name, interface, self.ips.get(interface, ""), )

Any idea what's going on? I'm using python 3.7.6.

grese commented 4 years ago

Here's a PR that I merged on my fork if you'd like to see the change:

https://github.com/grese/k8s-topo/pull/2/commits/4fde8c23712429cd667eee595f0a584bbc7dcc17

networkop commented 4 years ago

this should be fixed in https://github.com/networkop/k8s-topo/commit/ab4aa1805f1e600605f8f8005a90758426028d84

grese commented 4 years ago

Thank you! I grabbed the commit... looks good!

I have had a bit of trouble getting it running on OS X. I'm using Docker desktop and have Kubernetes installed and configured. However, I'm a bit of a Kubernetes noob, so I am probably doing something wrong.

When I try to run an example (k8s-topo --create examples/3node-ceos.yml), I get the following error. Could you please tell me if you happen to know what I'm missing?

  File "/Users/grese/Projects/CMU/NetworkSec/ddos-recon/venv/lib/python3.7/site-packages/kubernetes/client/rest.py", line 222, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Content-Type': 'text/plain; charset=utf-8', 'X-Content-Type-Options': 'nosniff', 'Date': 'Mon, 06 Apr 2020 02:42:20 GMT', 'Content-Length': '19'})
HTTP response body: 404 page not found

Just in case you are curious, I'll give you a quick description of my use-case. I'm doing some DDoS simulations, and was thinking I'd try to use use k8s-topo to spin up the network topology.

networkop commented 4 years ago

i think this is because you haven't got meshnet-cni installed? basically you first need to pick if you're going to use meshnet-cni or NSM, install one of them and then you should be able to run --create