You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
so i wanted to recreate the module prototypes using python classes and the provided models in /src/opnsense/mvc/app/models/OPNsense/. so i wrote myself a parser that creates classes from the prototypes.
But then i notices that elements dont get placed in the same field in /conf/config.xml
For example i cant add Firewall lan rules like i add snat rules, but the prototypes are both in the same xml file.
Then i thought: ok never mind, i just can search the parent element, but this wont work either cause the structure of the containers also differs.
in the config.xml i can only apply snat rules via OPNsense.Firewall.Filter and rules only under filter.rules. Is there any other way i can find all the attributes for the wrapper-classes i want to create, other than scanning the php-files, or adding every module-elemt at least a single time via the web gui?
I am not really sure i f i should use the php scripts rather than the daemon or something else.
I just dont know if configd is having a in memory representation of the config.xml.
so it wouldbe cool if i could add the objects directly to the registry, rather than dumping xmls. for example like this:
ji-podhead
changed the title
How to use configd.py or the backend registry/database to add elements using a python script
How to use configd.py or the backend registry/database to add elements using a python script and without writing xml
Nov 19, 2024
Mhh, I don't think we should support writing confg.xml directly from configd -- it has read access for templating, but the rest is better done via PHP as it always has been.
Hi,
so i wanted to recreate the module prototypes using python classes and the provided models in
/src/opnsense/mvc/app/models/OPNsense/
. so i wrote myself a parser that creates classes from the prototypes.But then i notices that elements dont get placed in the same field in /conf/config.xml
For example i cant add Firewall lan rules like i add snat rules, but the prototypes are both in the same xml file.
Then i thought: ok never mind, i just can search the parent element, but this wont work either cause the structure of the containers also differs.
Example Filter.xml
this is the model file
but snatrules are under:
in the config.xml i can only apply snat rules via OPNsense.Firewall.Filter and rules only under filter.rules.
Is there any other way i can find all the attributes for the wrapper-classes i want to create, other than scanning the php-files, or adding every module-elemt at least a single time via the web gui?
I am not really sure i f i should use the php scripts rather than the daemon or something else.
I just dont know if configd is having a in memory representation of the config.xml.
so it wouldbe cool if i could add the objects directly to the registry, rather than dumping xmls. for example like this:
The text was updated successfully, but these errors were encountered: