---
# System prepended metadata

title: N2T Prefix Generation

---

# N2T Prefix Generation

Workflow for generating the source of truth for N2T resolver operations.

Interactions with N2T are through the web interface. The web folder layout is described at: https://github.com/CDLUC3/n2t-admin/blob/main/n2tops.md (don't look at the version in Kunze's repo - it is out of date)

The web root `/` starts at `/apps/n2t/sv/cv2/apache2/htdocs`

Code update procedure is:
```
cd $sv/build/eggnog
n2t import
n2t rollout
n2t test
```

New NAANs are published via `pfx pfxsync` as described in the [`N2T Ops docs`](https://github.com/CDLUC3/n2t-admin/blob/main/n2tops.md#administration-applying-naan-registry-updates). Basically:

```
ssh remote pfx init
scp ~/pfx_harvest remote
scp $sv/apache2/$pfx_work/import remote:sv/cur/apache2/$pfx_work
ssh remote pfx test_rollout_n2t_test
```

The files used in `pfx pfxsync` are in `$pfx_import` and `$pfx_harvest`. These are defined at around `pfx:2649`:
```
pfx_work=pfx
pfx_import=$sv/apache2/$pfx_work/import	
pfx_build=$buildout_root/$pfx_work/build
```
and `pfx:361`:
```
pfx_harvest=~/pfx_harvest
```

That content is updated by submissions through the N2T "service interface" and through cron jobs.

```
# Fetch/import prefixes from EBI at 05:30 GMT, usually quarantined on a stg
# instance and tested on dev to prevent mishaps in prd.
# yyy are prefix backups being done?

30 21 * * 1-7 bash -lc "egg -q cfq prefix_import && pfx cron_hitrnt $MAILTO ids-n2t2-dev.n2t.net"
```
`egg cfq prefix_import`, "return config variable plus exit status", the config variable here being `prefix_import`.
`pfx cron_hitrnt`


---

The file `n2t:/e/n2t_full_prefixes.yaml` is identical to `/apps/n2t/sv/cv2/apache2/htdocs/prefixes.yaml`

The file `/apps/n2t/sv/cv2/apache2/htdocs/prefixes.yaml` is generated by the [`pfx` command](https://github.com/jkunze/n2t-admin/blob/main/pfx).

```graphviz
digraph prefixes {
rankdir=LR;
fontname="cousine"
fontsize=10
node[fontname="cousine" fontsize=11 margin=0.15]
subgraph cluster_maint {
  label="n2t.net/e/pub\nDownload to quarantine"
  naan_reg [label="naan_registry.txt"]
  shoulder_reg [label="shoulder_registry.txt"]
  master_shoulders [label="master_shoulders.txt"]
  lsregistry [label="lsregistry.yml"]
  naan_table [label="naan_table.txt"]
}

ebireg [label="ebireg.xml" color=gray fontcolor=gray]
ebiregy[label="ebireg.yaml"]
ebireg -> ebiregy [label="validate_ebi:973"];
ebiregy -> ebi [label="pfx_validate_prefixes:1155"]

subgraph cluster_ebi{   label="registry.api.identifiers.org\n/resolutionApi\n/getResolverDataset"
  margin=40
  ebinewreg [label="ebinewreg.json"]
 }
subgraph cluster_newreg {
  margin=30
  label="prefix.cc/popular/\nall.file.json"
  prefixcc [label="prefixcc.json"]
}

prefixes [label="prefixes.yaml"]

naansa [label="naans.anvl"]
shnaansha [label="shnaansh.anvl"]
shouldersa [label="shoulders.anvl"]
ebia [label="ebi.anvl"]
pfxcomsa [label="pfxcoms.anvl"]
ebi [label="ebi.yaml"]

lsregistry -> pfxcomsa
naan_reg -> naansa 
shoulder_reg -> shnaansha
master_shoulders -> shouldersa

pre_pub [label="pre_pub.yaml"]

ebinewreg -> ebia;

ebia -> pre_pub;
naansa -> prefixes;
shnaansha -> prefixes;
shouldersa -> prefixes;
ebia -> prefixes;
pfxcomsa -> prefixes;

prefixes -> n2t_prefixes;

pre_pub -> cdl_ebi_prefixes;

pfx_base [label="pfx_base.yaml"]
pfx_base -> prefixes [label="pfx"]

prefixes [label="prefixes.yaml"]
cdl_ebi_prefixes [label="cdl_ebi_prefixes.yaml"]
n2t_prefixes [label="n2t_prefixes.yaml"]
n2t_full_prefixes [label="n2t_full_prefixes.yaml"]
}
```