Skip to content

Commit 6caeb43

Browse files
committed
relocate files and update workflow to build enterprise sql
1 parent 1f82fc0 commit 6caeb43

File tree

7 files changed

+250709
-250695
lines changed

7 files changed

+250709
-250695
lines changed

.github/workflows/update_products.yml renamed to .github/workflows/update_tables.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Update Products
1+
name: Update Lookup Tables
22
on:
33
workflow_dispatch:
44
inputs:
@@ -14,33 +14,46 @@ on:
1414
# branches:
1515
# - master
1616
jobs:
17-
update_products:
17+
update_tables:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v2
2121
with:
2222
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
2323
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
2424

25+
- name: Install Perl dependencies
26+
run: |
27+
sudo apt install cpanminus
28+
cpanm Text::CSV
29+
2530
- name: Download and Build Products Table
2631
run: |
27-
cd products
28-
echo 'DELETE FROM "product";' > ./product.sql.new
29-
echo 'COPY "product" ("oid", "mib", "leaf", "description") FROM STDIN;' >> ./product.sql.new
32+
export TARGET="products/product.sql"
33+
echo 'DELETE FROM "product";' > ${TARGET}.new
34+
echo 'COPY "product" ("oid", "mib", "leaf", "description") FROM STDIN;' >> ${TARGET}.new
3035
curl --silent --location "https://mibbrowser.online/mibdb_search.php?all=1" | \
3136
grep JUNIPER-CHASSIS-DEFINES | \
3237
grep -o 'mib=[^"]\+' | \
3338
sed -e 's/mib=//' | \
3439
grep -hi -E '(product|oid|JUNIPER-CHASSIS-DEFINES)' | \
3540
while read mib; do \
3641
curl --silent --location "https://mibbrowser.online/mibs_json/$mib.json" | \
37-
./pysmi-json-to-products-table.py >> ./product.sql.new; \
42+
products/pysmi-json-to-products-table.py >> ${TARGET}.new; \
3843
done
39-
echo '\.' >> ./product.sql.new
40-
echo '' >> ./product.sql.new
41-
echo '' >> ./product.sql.new
42-
mv ./product.sql.new ./product.sql
44+
echo '\.' >> ${TARGET}.new
45+
mv ${TARGET}.new ${TARGET}
4346
47+
- name: Download and Build Enterprises Table
48+
run: |
49+
export TARGET="ieee/SMI/enterprise.sql"
50+
echo 'DELETE FROM "enterprise";' > ${TARGET}.new
51+
echo 'COPY "enterprise" ("enterprise_number", "organization") FROM STDIN;' >> ${TARGET}.new
52+
curl --silent --location "https://www.iana.org/assignments/enterprise-numbers.txt" | \
53+
ieee/SMI/smi-to-enterprise-table.py >> ${TARGET}.new
54+
echo '\.' >> ${TARGET}.new
55+
mv ${TARGET}.new ${TARGET}
56+
4457
- name: Commit files
4558
run: |
4659
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"

ieee/MA/manufacturer.sql

Lines changed: 47816 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.

0 commit comments

Comments
 (0)