Public Member Functions | |
def | __init__ |
Instantiates a Nfio object. More... | |
def | access |
def | chmod |
def | chown |
def | getattr |
Returns the file attributes of the file specified by path Args: path: Path of the file fh: Open file handle to the file Returns: A dictionary containing file attributes. More... | |
def | readdir |
def | readlink |
def | mknod |
def | rmdir |
def | mkdir |
The semantics have been redefined to create a new VNF instance when a directory is created under a specific type of VNF directory. More... | |
def | statfs |
def | unlink |
def | symlink |
def | rename |
def | link |
def | utimens |
def | open |
def | create |
def | read |
Reads an open file. More... | |
def | write |
Write to an open file. More... | |
def | truncate |
def | flush |
def | release |
def | fsync |
Public Attributes | |
root | |
mountpoint | |
hypervisor | |
vnfs_ops | |
module_root | |
def nfio.Nfio.__init__ | ( | self, | |
root, | |||
mountpoint, | |||
hypervisor = 'Docker' , |
|||
module_root = 'middleboxes' |
|||
) |
Instantiates a Nfio object.
Args: root: The root directory of nfio file system. The root directory stores persistent state about the system. mountpoint: The mountpoint of nfio file system. The mountpoint is required to intercept the file system calls via fuse. All the file system calls for fuse mounted files/directories are intercepted by libfuse and our provided implementation is executed. hypervisor: The type of hypervisor to use for deploying VNFs. The default is to use Docker containers. However, we also plan to add support for Libvirt. module_root: Root directory of the middlebox modules. Each middlebox provides it's own implementation of certain system calls in a separate module. module_root points to the root of that module. If nothing is provided a default of 'middleboxes' will be assumed. Returns: Nothing. Mounts nf.io file system at the specified mountpoint and creates a loop to act upon different file system calls.
Definition at line 52 of file nfio.py.
def nfio.Nfio.getattr | ( | self, | |
path, | |||
fh = None |
|||
) |
Returns the file attributes of the file specified by path Args: path: Path of the file fh: Open file handle to the file Returns: A dictionary containing file attributes.
The dictionary contains the following keys: st_atime: Last access time st_ctime: File creation time st_gid: Group id of the owner group st_mode: File access mode st_mtime: Last modification time st_nlink: Number of symbolic links to the file st_size: Size of the file in bytes st_uid: User id of the file owner Note: For special placeholder files for VNFs, st_size is set to a constant 1000. This is to make sure read utilities such as cat work for these special placeholder files.
Definition at line 119 of file nfio.py.
def nfio.Nfio.mkdir | ( | self, | |
path, | |||
mode | |||
) |
The semantics have been redefined to create a new VNF instance when a directory is created under a specific type of VNF directory.
Args: path: path of the directory to create. The path also represents the name of the new VNF instance to be created. mode: File access mode for the new directory. Returns: If path does not correspond to a directory under a specific VNF type directory then errno.EPERM is returned. Otherwise the return code is same as os.mkdir()'s return code.
Definition at line 188 of file nfio.py.
def nfio.Nfio.read | ( | self, | |
path, | |||
length, | |||
offset, | |||
fh | |||
) |
Reads an open file.
This nfio specific implementation parses path to see if the read is from any VNF or not. In case the read is from a VNF, the corresponding VNF module is loaded and the module's _read function is invoked to complete the read system call.
Args: path: path represents the path of the file to read from length: number of bytes to read from the file offset: byte offset indicating the starting byte to read from fh: file descriptor of the open file represented by path
Returns: length bytes from offset byte of the file represented by fh and path
Notes: VNFs can have special files which are placeholders for statistics such as number of received/sent bytes etc. VNFs provide their own implementation of read and handle reading of these special placeholder files.
Definition at line 273 of file nfio.py.
def nfio.Nfio.write | ( | self, | |
path, | |||
buf, | |||
offset, | |||
fh | |||
) |
Write to an open file.
In this nfio specific implementation the path is parsed to see if the write is for any specific VNF or not. If the write is for any file under a VNF directory then the corresponding VNF module is loaded and the module's _write function is invoked.
Args: path: path to the file to write buf: the data to write offset: the byte offset at which the write should begin fh: file descriptor of the open file represented by path
Returns: Returns the number of bytes written to the file starting at offset
Note: VNFs can have special files where writing specific strings trigger a specific function. For example, writing 'activate' to the 'action' file of a VNF will start the VNF. VNF specific modules handle such special cases of writing.
Definition at line 309 of file nfio.py.