Skip to content

Commit

Permalink
Merge pull request #50 from noironetworks/abhi-changes
Browse files Browse the repository at this point in the history
Changes to support Telco requirements - For any questions or issues Please Contact @camrossi, @abhis2112.
  • Loading branch information
samiib authored Sep 25, 2023
2 parents 1c3e18e + 7fdecf6 commit 071d91d
Show file tree
Hide file tree
Showing 9 changed files with 1,042 additions and 127 deletions.
2 changes: 1 addition & 1 deletion app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ ENV PATH "$PATH:/app"
COPY requirements.txt requirements.txt
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing g++ gcc make && pip3 install -r requirements.txt
COPY . .
RUN chmod +x /app/*
RUN chmod +x /app/*
361 changes: 318 additions & 43 deletions app/graph.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import urllib3

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# PyACI requires to have the MetaData present locally. Since the metada changes depending on the APIC version I use an init container to pull it.
# No you can't put it in the same container as the moment you try to import pyaci it crashed is the metadata is not there. Plus init containers are cool!
Expand All @@ -24,6 +25,7 @@

url = "https://" + os.environ.get("APIC_IPS").split(',')[0] + '/acimeta/aci-meta.json'
r = requests.get(url, verify=False, allow_redirects=True)

if os.environ.get("MODE") == "LOCAL":
open('/tmp/aci-meta-vkaci.json','wb').write(r.content)
else:
Expand Down
227 changes: 157 additions & 70 deletions app/template/assets/cui-2.0.0/js/vkaci.js

Large diffs are not rendered by default.

21 changes: 18 additions & 3 deletions app/template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,22 @@
<button class="btn btn--white btn--dropdown selected view">Different Views</button>
<div id="selected_views" class="dropdown__menu dropdown__menu--openleft">
<a id="PodsAndNodes" onclick="draw_pods_and_nodes()">Pods & Nodes</a>
<a id="WithoutBgpPeers" onclick="draw_without_bgp_peers()">Without Bgp Peers</a>
{% if asnPresent %}
<a id="WithoutBgpPeers" onclick="draw_without_bgp_peers()">Without Bgp Peers</a>
{% endif %}
<a id="WithoutPods" onclick="draw_without_pods()">Without Pods</a>
<a id="OnlyBgpPeers" onclick="draw_only_bgp_peers()">BGP Peers</a>
{% if asnPresent %}
<a id="OnlyBgpPeers" onclick="draw_only_bgp_peers()">BGP Peers</a>
{% endif %}
{% if sriov or macvlan %}
<a id="OnlyPrimarylinks" onclick="draw_only_primary_links()">Primary Links</a>
{% if sriov %}
<a id="OnlySriovlinks" onclick="draw_only_sriov_links()">SRIOV Links</a>
{% endif %}
{% if macvlan %}
<a id="OnlyMacvlanlinks" onclick="draw_only_macvlan_links()">MacVlan Links</a>
{% endif %}
{% endif %}
<div class="dropdown__divider"></div>
<a id="All" onclick="draw_all()">View All</a>
</div>
Expand Down Expand Up @@ -271,7 +284,9 @@
<div id="selected_table" class="dropdown__menu dropdown__menu--openleft">
<a id="LeafsAndPods" onclick="table_leafs_pods()">Leafs & Pods</a>
<a id="LeafsAndNodes" onclick="table_leafs_nodes()">Leafs & Nodes</a>
<a id="BgpPeers" onclick="table_bgp_peers()">BGP Peers</a>
{% if asnPresent %}
<a id="BgpPeers" onclick="table_bgp_peers()">BGP Peers</a>
{% endif %}
<a id="Services" onclick="table_services()">Services</a>
<div class="dropdown__divider"></div>
<a id="All" onclick="table_all()">View All</a>
Expand Down
3 changes: 2 additions & 1 deletion app/visibility_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def index():
return render_template('index.html', version=__build__, env=env, pod_names=topology.get_pods(),
node_names=topology.get_nodes(), namespaces=topology.get_namespaces(),
leaf_names=topology.get_leafs(), label_names=topology.get_labels(),
asnPresent=topology.asnPresent)
asnPresent=topology.asnPresent, sriov=topology.sriov, macvlan=topology.macvlan)


@app.route('/pod_names')
def pod_names():
Expand Down
31 changes: 31 additions & 0 deletions helm/templates/nfna_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Add permission to list the nodefabricnetworkattachments
{{- if .Values.cno }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: "{{ include "vkaci.fullname" . }}-nodefabricnetworkattachments-reader"
labels:
{{- include "vkaci.labels" . | nindent 4 }}
namespace: aci-containers-system
rules:
- apiGroups: ["aci.fabricattachment"]
resources: ["nodefabricnetworkattachments"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: "{{ include "vkaci.fullname" . }}-nodefabricnetworkattachments-binding"
labels:
{{- include "vkaci.labels" . | nindent 4 }}
namespace: aci-containers-system
subjects:
- kind: ServiceAccount
name: {{ include "vkaci.fullname" . }}
namespace: {{ .Release.Namespace }}
roleRef:
# "roleRef" specifies the binding to a Role / ClusterRole
kind: Role # this must be Role or ClusterRole
name: {{ include "vkaci.fullname" . }}-nodefabricnetworkattachments-reader # this must match the name of the Role or ClusterRole you wish to bind to
apiGroup: rbac.authorization.k8s.io
{{- end }}
4 changes: 3 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ lldpd:
image:
repository: ghcr.io/lldpd/lldpd
tag: latest
pullPolicy: Always
pullPolicy: Always

cno: false
Loading

0 comments on commit 071d91d

Please sign in to comment.