forked from kytos/flow_manager
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from kytos-ng/pipeline_installation
Added new keys to flow
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from kytos.core.db import mongo_client | ||
from bson.decimal128 import Decimal128 | ||
from decimal import Decimal | ||
|
||
|
||
client = mongo_client() | ||
collection = client["napps"]["flows"] | ||
|
||
# Flows from mef_eline, table groups available: epl, evpl | ||
query_match = { | ||
"flow.cookie": { | ||
"$gte": Decimal128(Decimal(12249790986447749120)), | ||
"$lte": Decimal128(Decimal(12321848580485677055)), | ||
}, | ||
"flow.match.dl_vlan": { | ||
"$ne": None, | ||
} | ||
} | ||
update = { | ||
"$set": { | ||
"flow.owner": "mef_eline", | ||
"flow.table_group": "evpl" | ||
} | ||
} | ||
flows = collection.update_many(query_match, update) | ||
print(f"{flows.modified_count} mef_eline flows were modified as EVPL.") | ||
|
||
query_match = { | ||
"flow.cookie": { | ||
"$gte": Decimal128(Decimal(12249790986447749120)), | ||
"$lte": Decimal128(Decimal(12321848580485677055)), | ||
}, | ||
"flow.match.dl_vlan": { | ||
"$eq": None, | ||
} | ||
} | ||
update = { | ||
"$set": { | ||
"flow.owner": "mef_eline", | ||
"flow.table_group": "epl" | ||
} | ||
} | ||
flows = collection.update_many(query_match, update) | ||
print(f"{flows.modified_count} mef_eline flows were modified as EPL") | ||
|
||
# Flows from of_lldp | ||
query_match = { | ||
"flow.cookie": { | ||
"$gte": Decimal128(Decimal(12321848580485677056)), | ||
"$lte": Decimal128(Decimal(12393906174523604991)), | ||
} | ||
} | ||
update = { | ||
"$set": { | ||
"flow.owner": "of_lldp", | ||
"flow.table_group": "base" | ||
} | ||
} | ||
flows = collection.update_many(query_match, update) | ||
print(f"{flows.modified_count} of_lldp flows were modified as base") | ||
|
||
# Flows from coloring | ||
query_match = { | ||
"flow.cookie": { | ||
"$gte": Decimal128(Decimal(12393906174523604992)), | ||
"$lte": Decimal128(Decimal(12465963768561532927)), | ||
} | ||
} | ||
update = { | ||
"$set": { | ||
"flow.owner": "coloring", | ||
"flow.table_group": "base" | ||
} | ||
} | ||
flows = collection.update_many(query_match, update) | ||
print(f"{flows.modified_count} coloring flows were modified as base") | ||
|
||
#Any other flow with cookie 0 | ||
query_match = { | ||
"flow.cookie": {"$eq": Decimal128(Decimal(0))} | ||
} | ||
update = { | ||
"$set": {"flow.table_group": "base"} | ||
} | ||
flows = collection.update_many(query_match, update) | ||
print(f"{flows.modified_count} flows were modified as base") |