Yang data type for IP-address and netmask

I have to take input of an IP with net mask.

i.e it can be ip-address and netmask denoted in dotted
it can be ip-address and /x

Just wondering how do i indicate a “/x” in yang

Also, is there specific data-type for netmask ? (which check for valid netmask)

See “ip-prefix” type in RFC 6991 Common YANG Data Types
and examples.confd/restconf/basic for an example using that type.

  import ietf-inet-types {
    prefix inet;
  leaf net {
    type inet:ip-prefix;