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

Diagram class related to #127 #135

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Diagram class related to #127 #135

wants to merge 7 commits into from

Conversation

sunami09
Copy link
Collaborator

  • Added graphviz to the list of installed dependencies
  • Updated the Python dependencies to include the diagrams package.
  • Added two new icons (host.png, switch.png) in /srv/icons/ for use in the diagram generation.
  • A new DiagramWorker class in RTMonLibs/DiagramWorker.py responsible for generating network topology diagrams using the diagrams package.
  • Added logic in worker.py to delete generated diagram images when executions are deleted.
  • Integrated DiagramWorker into the template creation process
  • The generated diagrams are saved under /srv/images with a unique reference ID for easy tracking.

@sunami09 sunami09 requested a review from juztas October 21, 2024 04:57
Copy link
Collaborator

@juztas juztas left a comment

Choose a reason for hiding this comment

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

Please run pylint on your python code and fix issues.

************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:12:0: C0115: Missing class docstring (missing-class-docstring)
test.py:60:12: W0106: Expression "val1['obj'] >> Edge(label=self.d_LinkLabel(val1, val2)) << val2['obj']" is assigned to nothing (expression-not-assigned)
test.py:69:35: R1733: Unnecessary dictionary index lookup, use 'vals' instead (unnecessary-dict-index-lookup)
test.py:74:39: R1733: Unnecessary dictionary index lookup, use 'vals' instead (unnecessary-dict-index-lookup)
test.py:79:39: R1733: Unnecessary dictionary index lookup, use 'vals' instead (unnecessary-dict-index-lookup)
test.py:81:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:94:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:94:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
test.py:108:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:108:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
test.py:117:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:125:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:126:38: C0121: Comparison 'self.popreverse == None' should be 'self.popreverse is None' (singleton-comparison)
test.py:128:40: C0121: Comparison 'self.popreverse == False' should be 'self.popreverse is False' if checking for the singleton value False, or 'not self.popreverse' if testing for falsiness (singleton-comparison)
test.py:130:40: C0121: Comparison 'self.popreverse == True' should be 'self.popreverse is True' if checking for the singleton value True, or 'bool(self.popreverse)' if testing for truthiness (singleton-comparison)
test.py:133:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:140:19: R1714: Consider merging these comparisons with 'in' by using 'self.popreverse in (None, False)'. Use a set instead if elements are hashable. (consider-using-in)
test.py:140:19: C0121: Comparison 'self.popreverse == None' should be 'self.popreverse is None' (singleton-comparison)
test.py:140:46: C0121: Comparison 'self.popreverse == False' should be 'self.popreverse is False' if checking for the singleton value False, or 'not self.popreverse' if testing for falsiness (singleton-comparison)
test.py:142:21: C0121: Comparison 'self.popreverse == True' should be 'self.popreverse is True' if checking for the singleton value True, or 'self.popreverse' if testing for truthiness (singleton-comparison)

------------------------------------------------------------------
Your code has been rated at 8.26/10 (previous run: 6.03/10, +2.23)

for rcfile - use this one: https://github.com/sdn-sense/siterm/blob/master/standarts/pylintrc (We should also upload rcfile to this repo too)

autogole-api/packaging/Dockerfile Outdated Show resolved Hide resolved
autogole-api/src/python/RTMonLibs/DiagramWorker.py Outdated Show resolved Hide resolved
@juztas
Copy link
Collaborator

juztas commented Oct 28, 2024

@sunami09
Copy link
Collaborator Author

sunami09 commented Nov 8, 2024

@juztas I added the BGP

@sunami09 sunami09 requested a review from juztas November 8, 2024 02:09
@juztas
Copy link
Collaborator

juztas commented Nov 8, 2024

I see no bgp added

#Generate Diagrams
try:
diagram_filename = f"{self.config.get('image_dir', '/srv/images')}/diagram_{kwargs['referenceUUID']}"
DiagramWorker(self.orderlist).createGraph(diagram_filename)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use class inheritance, same as we do for templates and other classes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got it

@sunami09
Copy link
Collaborator Author

sunami09 commented Nov 8, 2024

Idk what happened

(base) sunami@Sunamis-MacBook-Pro packaging % git status
On branch imageserver
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   files/etc/grid-security/hostcert.pem
        modified:   files/etc/grid-security/hostkey.pem
        modified:   files/etc/rtmon.yaml
        modified:   files/etc/sense-o-auth.yaml
        modified:   start-dev.sh
        modified:   ../src/python/RTMonLibs/DiagramWorker.py
        modified:   ../src/python/RTMonLibs/imageserver.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        diagram.png
        diagram2.png
        ../src/python/RTMonLibs/__pycache__/

no changes added to commit (use "git add" and/or "git commit -a")
(base) sunami@Sunamis-MacBook-Pro packaging % git add ../src/python/RTMonLibs/DiagramWorker.py
(base) sunami@Sunamis-MacBook-Pro packaging % git add ../src/python/RTMonLibs/DiagramWorker.py
(base) sunami@Sunamis-MacBook-Pro packaging % git commit -m "Added BGP"                       
[imageserver b6fd690] Added BGP
 Committer: Sunami Dasgupta <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email [email protected]

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 43 insertions(+)
(base) sunami@Sunamis-MacBook-Pro packaging % git push origin diagram-branch 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://github.com/esnet/sense-rtmon/
   f1fcc5d..98e18f4  diagram-branch -> diagram-branch
(base) sunami@Sunamis-MacBook-Pro packaging % git status                                      
On branch imageserver
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   files/etc/grid-security/hostcert.pem
        modified:   files/etc/grid-security/hostkey.pem
        modified:   files/etc/rtmon.yaml
        modified:   files/etc/sense-o-auth.yaml
        modified:   start-dev.sh
        modified:   ../src/python/RTMonLibs/imageserver.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        diagram.png
        diagram2.png
        ../src/python/RTMonLibs/__pycache__/

no changes added to commit (use "git add" and/or "git commit -a")
(base) sunami@Sunamis-MacBook-Pro packaging % 

@sunami09
Copy link
Collaborator Author

sunami09 commented Nov 8, 2024

image

@sunami09
Copy link
Collaborator Author

sunami09 commented Nov 8, 2024

image

@juztas
Copy link
Collaborator

juztas commented Nov 8, 2024

Based on output:

  1. you are on imageserver branch;
  2. you commit in imageserver branch;
  3. you push to origin diagram-branch branch;
    your commit is in imageserver branch (not in diagram-branch)

@sunami09
Copy link
Collaborator Author

sunami09 commented Nov 8, 2024

Oh Got it

@sunami09 sunami09 requested a review from juztas November 8, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants